c/10450: gcc-3.2.2 produces error on initializing a structure with a constant expression
niva@niisi.msk.ru
niva@niisi.msk.ru
Tue Apr 22 10:46:00 GMT 2003
>Number: 10450
>Category: c
>Synopsis: gcc-3.2.2 produces error on initializing a structure with a constant expression
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Apr 22 10:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Nadezhda I. Vyukova
>Release: gcc-3.2.2
>Organization:
>Environment:
i386 (i686-pc-linux-gnu)
gcc configured with --enable-cpp --enable-languages=all
--enable-shared
>Description:
The following error message is produced when I compile
the source code (gcc -S foo.c):
foo.c:14: initializer element is not constant
foo.c:14: (near initialization for `registers_pid_1')
foo.c:14: initializer element is not constant
I think that this behaviour contradicts to C99, 6.7.8-13. And note that gcc-2.95.3 compiles this code successfully.
>How-To-Repeat:
typedef struct t_inf_id {
int board;
int processor;
int process;
int thread;
} t_inf_id;
typedef struct inf_id {
unsigned long machine;
t_inf_id tid;
int att_flag;
} inf_id;
inf_id registers_pid_1 = ((inf_id) {0, (t_inf_id) {0, 0, -1, -1}, 0}); /* Error!*/
inf_id registers_pid_2 = ((inf_id) {0, {0, 0, -1, -1}, 0}); /* OK! */
t_inf_id t_registers_pid = ((t_inf_id) {0, 0, -1, -1}); /* OK! */
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list