This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/10450: gcc-3.2.2 produces error on initializing a structure with a constant expression
- From: niva at niisi dot msk dot ru
- To: gcc-gnats at gcc dot gnu dot org
- Date: 22 Apr 2003 10:40:41 -0000
- Subject: c/10450: gcc-3.2.2 produces error on initializing a structure with a constant expression
- Reply-to: niva at niisi dot msk dot ru
>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: