[cfe-dev] gcc quirk not implemented

Eli Friedman eli.friedman at gmail.com
Tue Oct 21 09:00:34 PDT 2008


On Tue, Oct 21, 2008 at 6:36 AM, Roman Divacky <rdivacky at freebsd.org> wrote:
> hi
>
> gcc accepts this code:
>
> int
> __xuname(int namesize, void *namebuf)
> {
>        struct xutsname {
>                char    sysname[namesize];      /* Name of this OS. */
>        } *name;
> }
>
> which clang refuses with:
>
> const.c:5:25: error: arrays with static storage duration must have constant integer length
>                char    sysname[namesize];      /* Name of this OS. */
>                                        ^~~~~~~
>
> note that this violates C99 but obviously it's used (for example in freebsd libc code)
> so I believe it should get implemented.

Thanks for the report; please file in Bugzilla so it doesn't get lost.
 Looks like a serious pain to implement (structs with multiple
variable-sized members, anyone?), but I guess that's gcc compat.

-Eli



More information about the cfe-dev mailing list