Internal Compiler Error with GCC 4.1.0
Gaurav Jain
gaurav.anywhere@gmail.com
Thu Nov 2 10:40:00 GMT 2006
On 11/2/06, Andrew Haley <aph@redhat.com> wrote:
> Gaurav Jain writes:
> > Hi,
> >
> > While compiling the piece of code at the end of this mail, I'm getting
> > an "Internal Compiler Error". I'm using GCC 4.1.0 on Fedora Core,
> > Kernel 2.6.15-1.
> >
> > This error only occurs with '-g' option. Also, gcc 3.2 works fine
> > with the same program.
> >
> > Is this a known bug in GCC 4.1?
>
> It's a bug; I can't tell if it's the same bug as those already known.
>
> > Is there a workaround that I could use such that the code compiles
> > with gcc 4.1?
>
> Well, it's very weird code. Why is u static, anyway?
Well this is just a little snippet form an existing codebase. As you
mentioned, 'u' need not be static, and in fact if I remove the static
keyword the error disappears!
>
> Andrew.
>
> > /*----- code follows ------*/
> > int main(int argc, char **argv)
> > {
> > if (sizeof(long) == 8)
> > {
> > volatile static union {
> > int i;
> > char c[8];
> > } u;
> >
> > int big_endian = (u.c[0] == 0x01 || u.c[1] == 0x02);
> > }
> > return 0;
> > }
> > /*--- code ends ------- */
>
More information about the Gcc-help
mailing list