This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 4.1.2 is giving compilation error with unnamed structure of register const variable
- From: Ian Lance Taylor <iant at google dot com>
- To: Muralidhar <muralidharvvkmca at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 24 Jul 2009 18:22:06 -0700
- Subject: Re: gcc 4.1.2 is giving compilation error with unnamed structure of register const variable
- References: <24647967.post@talk.nabble.com>
Muralidhar <muralidharvvkmca@gmail.com> writes:
> I have a sample program which is compiling fine in GCC version 3.3.3
> on SUSE Linux with kernel 2.6.5,
> but it is giving compilation error in GCC version 4.1.2 with SUSE
> Linux kernel 2.6.16
>
> >>Sample program <<
> $ cat exam.c
> #include <stdio.h>
> int main()
> {
> register const struct { short l; unsigned char d[2]; }
> vVRCU___I = { 2,"a" };
> register const struct { short l; char d[2]; }
> vVRC____I = { 2,"a" };
>
> return 0;
> }
>
> $ gcc exam.c --> gcc 4.1.2
> exam.c: In function ÃmainÃ:
> exam.c:5: error: register name not specified for ÃvVRC____IÃ
> exam.c:4: error: register name not specified for ÃvVRCU___IÃ
I think this is a bug.
To avoid the bug, remove the "register" keyword. There is no reason to
ever use the "register" keyword with current versions of gcc.
Ian