[cfe-dev] Address space qualifiers in compound literal type names

Eli Friedman eli.friedman at gmail.com
Wed Aug 26 11:19:02 PDT 2009


On Wed, Aug 26, 2009 at 4:23 AM, Ken Dyck<Ken.Dyck at onsemi.com> wrote:
> The first is when a compound literal appears in a function. Since the
> object allocated by the compound literal has automatic storage duration,
> I would expect that address specifiers in the type name would be
> prohibited, just as they are for automatic variables. Clang does not
> report this as an error. (FWIW, the Embedded C spec, ISO TR 18037,
> prohibits address space qualifiers from appearing in the type names of
> compound literals within functions).

That's a missing diagnostic; it's definitely not supposed to be legal.
 Patch welcome.

> The second is where the storage for the literal-generated object is
> allocated. It appears that the code generator always allocates the
> object in the generic address space even if an address space qualifier
> is given in the type name.

Well spotted; it turns out to be just a simple oversight in the code
generation.  I have a patch in hand which I'll commit as soon as I'm
finished rebuilding my tree.

> Are either of these bug-worthy?

Yes, both bug-worthy, but don't bother filing a bug for the code
generation issue, since I already have the fix.

-Eli



More information about the cfe-dev mailing list