This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37200] New: duplicate warning message with braced initializer list
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Aug 2008 12:14:42 -0000
- Subject: [Bug c/37200] New: duplicate warning message with braced initializer list
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
struct test {
void *tst;
};
struct yy {
void **z;
};
int foo(struct test *x)
{
struct yy y[] ={
{ (void**) &x->tst }
};
return 0;
}
$ gcc x.c -c -pedantic
x.c: In function ?foo?:
x.c:10: warning: initializer element is not computable at load time
x.c:10: warning: initializer element is not computable at load time
The duplicate perhaps also shows that we recurse too much here making the c
parser slower than it needs to be.
A backtrace of the first warning shows:
#0 output_init_element (value=0x2aaaab4c4200, strict_string=0 '\0',
type=0x2aaaab5100c0, field=0x2aaaab5bd280, pending=1) at
/home/manuel/test/src/gcc/c-typeck.c:6304
#1 0x0000000000436000 in process_init_element (value={value = 0x2aaaab4c4200,
original_code = ERROR_MARK}) at /home/manuel/test/src/gcc/c-typeck.c:6674
#2 0x0000000000471cbd in c_parser_initval (parser=0x2aaaab4c4140, after=0x0)
at /home/manuel/test/src/gcc/c-parser.c:3245
#3 0x0000000000471bc3 in c_parser_initelt (parser=0x2aaaab4c4140) at
/home/manuel/test/src/gcc/c-parser.c:3221
#4 0x000000000047151a in c_parser_braced_init (parser=0x2aaaab4c4140,
type=0x0, nested_p=1 '\001') at /home/manuel/test/src/gcc/c-parser.c:3019
#5 0x0000000000471c29 in c_parser_initval (parser=0x2aaaab4c4140, after=0x0)
at /home/manuel/test/src/gcc/c-parser.c:3236
#6 0x0000000000471bc3 in c_parser_initelt (parser=0x2aaaab4c4140) at
/home/manuel/test/src/gcc/c-parser.c:3221
#7 0x000000000047151a in c_parser_braced_init (parser=0x2aaaab4c4140,
type=0x0, nested_p=0 '\0') at /home/manuel/test/src/gcc/c-parser.c:3019
#8 0x00000000004713e1 in c_parser_initializer (parser=0x2aaaab4c4140) at
/home/manuel/test/src/gcc/c-parser.c:2981
#9 0x000000000046dfd3 in c_parser_declaration_or_fndef (parser=0x2aaaab4c4140,
fndef_ok=0 '\0', empty_ok=1 '\001', nested=1 '\001', start_attr_ok=1 '\001')
at /home/manuel/test/src/gcc/c-parser.c:1227
Here value is an ADDR_EXPR
A backtrace of the second warning shows that we went through the same code
again:
#0 output_init_element (value=0x2aaaab64d8d0, strict_string=0 '\0',
type=0x2aaaab64e0c0, field=0x2aaaab505390, pending=1) at
/home/manuel/test/src/gcc/c-typeck.c:6304
#1 0x000000000043654b in process_init_element (value={value = 0x2aaaab64d8d0,
original_code = ERROR_MARK}) at /home/manuel/test/src/gcc/c-typeck.c:6814
#2 0x0000000000471cbd in c_parser_initval (parser=0x2aaaab4c4140, after=0x0)
at /home/manuel/test/src/gcc/c-parser.c:3245
#3 0x0000000000471bc3 in c_parser_initelt (parser=0x2aaaab4c4140) at
/home/manuel/test/src/gcc/c-parser.c:3221
#4 0x000000000047151a in c_parser_braced_init (parser=0x2aaaab4c4140,
type=0x0, nested_p=0 '\0') at /home/manuel/test/src/gcc/c-parser.c:3019
#5 0x00000000004713e1 in c_parser_initializer (parser=0x2aaaab4c4140) at
/home/manuel/test/src/gcc/c-parser.c:2981
Here value is a 'constructor' which itself contains the previous addr_expr.
It is not clear to me what is going on. Any help to untangle this would be
appreciated.
--
Summary: duplicate warning message with braced initializer list
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: manu at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37200