This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/5336: initializer element is not constant
- From: Luben Tuikov <luben at splentec dot com>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 29 Apr 2002 20:46:02 -0000
- Subject: Re: c/5336: initializer element is not constant
- Reply-to: Luben Tuikov <luben at splentec dot com>
The following reply was made to PR c/5336; it has been noted by GNATS.
From: Luben Tuikov <luben@splentec.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, dima@cc.hut.fi,
gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: c/5336: initializer element is not constant
Date: Mon, 29 Apr 2002 16:37:05 -0400
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5336
I've reconfirmed this error on gcc 3.0.4/GNU/Linux 2.4.18/Red Hat 7.1.
It is gcc's error!
Here is my code:
---cut-----------------
#include <stdio.h>
typedef struct {
int i;
char c;
} IC_t;
const IC_t def_tic = { 'A', 'A' };
static const int testme = sizeof(int) + def_tic.i; /* gcc-gcc, where are you? */
int main()
{
def_tic.c = 'b'; /* error ok */
/* threaten to use */
printf("def_tic.c = %c\n", def_tic.c);
return 0;
}
---cut-----------------
Furthermore, ``def_tic'' is put into the read-only
section of the ELF, just as ``testme'' would be if
it could compile it -- still gcc doesn't consider
it and craps out.
This is somewhat a severe bug, as it forces me to write
ugly code (workarounds gcc's behavior).
Please, please, fix it.
--
Luben