This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/5336: initializer element is not constant


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


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