[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#684635: ICE when compiling malformed struct initializers



Package: gcc-4.7
Version: 4.7.1-6
Severity: minor

The following invalid C code triggers an segmentation fault
in gcc-4.7:

cat > t.c <<'EOF'
struct bla{char **a;};void test(void){struct bla b = {.a =(char**){"a","b"}};}
EOF
gcc -c t.c

results in:
| t.c: In function ‘test’:
| t.c:1:46: warning: initialization from incompatible pointer type [enabled by default]
| t.c:1:46: warning: (near initialization for ‘(anonymous)’) [enabled by default]
| t.c:1:46: warning: excess elements in scalar initializer [enabled by default]
| t.c:1:46: warning: (near initialization for ‘(anonymous)’) [enabled by default]
| t.c:1:50: internal compiler error: Segmentation fault
| Please submit a full bug report,

while gcc-snapshot  20120714-1 says:
| t.c: In function 'test':
| t.c:1:46: warning: initialization from incompatible pointer type [enabled by default]
|  struct bla{char **a;};void test(void){struct bla b = {.a =(char**){"a","b"}};}
|                                               ^
| t.c:1:46: warning: (near initialization for '(anonymous)') [enabled by default]
| t.c:1:46: warning: excess elements in scalar initializer [enabled by default]
| t.c:1:46: warning: (near initialization for '(anonymous)') [enabled by default]
| t.c:1:50: internal compiler error: tree check: expected constructor, have nop_expr in optimize_compound_literals_in_ctor, at gimplify.c:3855
|  struct bla{char **a;};void test(void){struct bla b = {.a =(char**){"a","b"}};}
|                                                   ^
| Please submit a full bug report,

-- System Information:
Debian Release: wheezy/sid
Architecture: amd64 (x86_64)

Versions of packages gcc-4.7 depends on:
ii  binutils      2.22-7.1
ii  cpp-4.7       4.7.1-6
ii  gcc-4.7-base  4.7.1-6
ii  libc6         2.13-35
ii  libgcc1       1:4.7.1-6
ii  libgmp10      2:5.0.5+dfsg-2
ii  libgomp1      4.7.1-6
ii  libitm1       4.7.1-6
ii  libmpc2       0.9-4
ii  libmpfr4      3.1.0-5
ii  libquadmath0  4.7.1-6
ii  zlib1g        1:1.2.7.dfsg-13

Versions of packages gcc-4.7 recommends:
ii  libc6-dev  2.13-35

Versions of packages gcc-4.7 suggests:
pn  binutils-gold        <none>
pn  gcc-4.7-doc          <none>
pn  gcc-4.7-locales      <none>
ii  gcc-4.7-multilib     4.7.1-6
pn  libgcc1-dbg          <none>
pn  libgomp1-dbg         <none>
pn  libitm1-dbg          <none>
pn  libmudflap0-4.7-dev  <none>
pn  libmudflap0-dbg      <none>
pn  libquadmath0-dbg     <none>

-- no debconf information


Reply to: