This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Broken C array autosizing breaks glibc compile


On Thu, 21 Sep 2000, Kaz Kylheku wrote:
> On Thu, 21 Sep 2000, Franz Sirl wrote:
> > Date: Thu, 21 Sep 2000 23:18:46 +0200
> > From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
> > To: gcc-bugs@gcc.gnu.org
> > Cc: libc-alpha@sources.redhat.com
> > Subject: Broken C array autosizing breaks glibc compile
> >
> > Hi,
> >
> > with current CVS gcc at least PPC and alpha have problems with compiling
> > a locale test in the glibc testsuite. Inspection shows that gcc
> > miscompiles this routine:
>
> [ snip ]
>
> > static const struct keyword_t *
> > repertoiremap_hash (const char *str, unsigned int len)
> > {
> >   static const struct keyword_t wordlist[0] =
>
> This is not valid C. In C, arrays must have a positive size.
> Unfortunately, gcc only diagnoses this error if you give it -pedantic:
>
> 	warning: ANSI C forbids zero-size array `wordlist'
>
> > So wordlist is never initialized :-(. If I change the wordlist[0] to
>
> What does it mean to initialize a zero-length object?
>
> The only reasonable thing would be for the compiler to emit a diagnostic,
> like ``too many elements in initializer for array dimension''.

Well, I seemed to remember this is a GCC extension (especially since -Wall 
didn't warn and it was working with earlier compilers), but looking in the 
docs I cannot find it...

So if it's no GCC extension, the bug is in glibc's repertoire.c.

Franz.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]