From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28173 invoked by alias); 29 Apr 2002 20:46:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 28141 invoked by uid 71); 29 Apr 2002 20:46:02 -0000 Date: Mon, 29 Apr 2002 13:46:00 -0000 Message-ID: <20020429204602.28140.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Luben Tuikov Subject: Re: c/5336: initializer element is not constant Reply-To: Luben Tuikov X-SW-Source: 2002-04/txt/msg01612.txt.bz2 List-Id: The following reply was made to PR c/5336; it has been noted by GNATS. From: Luben Tuikov 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 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