I have had this bug with differents GCC releases: Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.4/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux Thread model: posix gcc version 3.3.4 (Debian) Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c --disable-libgcj --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030422 (Red Hat Linux 3.2.3-6) Reading specs from /global/morpork/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/specs Configured with: ./configure --prefix=/global/morpork/gcc-3.4 Thread model: posix gcc version 3.4.1 It seems to work fine with: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) Here are the ouput with GCC 3.4.1: morpork may 58 % /global/morpork/gcc-3.4/bin/gcc -I. -I/users/spaces/logiciels/mpfr-2.0.2/k7//include -I/users/spaces/logiciels/gmp-4.1.2/k7//include -g -DWANT_ASSERT -Wall -Wmissing-prototypes -c dump.c -save-temps dump.c: In function `may_dump_rec': dump.c:51: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. This has been tested on different systems too (P3, P4, athlon and amd64).
Created attachment 6753 [details] The preprocessed file
On the mainline I do not get a seg fault but a normal ICE: pr16566.c: In function `may_dump_rec': pr16566.c:3565: internal compiler error: in create_tmp_var, at gimplify.c:358 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Confirmed: ------------------------ struct S; struct C { int i; struct S *tab[]; }; struct S { struct C c; }; void foo (struct S *x) { foo(((void)1, x->c).tab[0]); } --------------------- g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.c x.c: In function `foo': x.c:11: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. g/x> /home/bangerth/bin/gcc-3.5-pre/bin/gcc -c x.c x.c: In function `foo': x.c:11: internal compiler error: in create_tmp_var, at gimplify.c:358 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. This used to work with 3.2 and 3.3, so is a regression in 3.4 and mainline. W.
*** Bug 16575 has been marked as a duplicate of this bug. ***
Even shorter example: ============================= struct A { int i; int x[]; }; int foo(struct A a) { return (a,a).x[0]; } =============================
: Search converges between 2003-11-07-trunk (#398) and 2003-11-08-trunk (#399).
The only thing during that time period that seems likely is: 2003-11-08 Joseph S. Myers <jsm@polyomino.org.uk> * c-typeck.c (pedantic_lvalue_warning): Deprecate compound expressions as lvalues. (internal_build_compound_expr): Remove special handling for non-pedantic case. * doc/extend.texi: Document that all extended lvalues are now deprecated.
Which looks right as the following is produced: { return (a, NON_LVALUE_EXPR <a.x>)[0]; }
Subject: Re: [3.4/3.5 Regression] ICE with flexible arrays Note that this already fails with 3.2.3 if you use -std=c99 -pedantic. Also note that though the code should be accepted, it has undefined behavior if executed; a non-lvalue with structure with flexible array member type is a value that does not refer to an object (other than a temporary that disappears at the next sequence point), so members of the flexible array can't be accessed without undefined behavior.
Postponed until GCC 3.4.3.
Subject: Bug 16566 CVSROOT: /cvs/gcc Module name: gcc Changes by: jsm28@gcc.gnu.org 2004-09-22 22:51:58 Modified files: gcc : ChangeLog c-typeck.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: pr16566-1.c pr16566-2.c pr16566-3.c Log message: PR c/16566 * c-typeck.c (build_component_ref): Don't special-case COMPOUND_EXPR. testsuite: * gcc.c-torture/compile/pr16566-1.c, gcc.c-torture/compile/pr16566-2.c, gcc.c-torture/compile/pr16566-3.c: New tests. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5568&r2=2.5569 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.377&r2=1.378 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4329&r2=1.4330 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 16566 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: jsm28@gcc.gnu.org 2004-09-23 15:05:21 Modified files: gcc : ChangeLog c-typeck.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: pr16566-1.c pr16566-2.c pr16566-3.c Log message: PR c/16566 * c-typeck.c (build_component_ref): Don't special-case COMPOUND_EXPR. testsuite: * gcc.c-torture/compile/pr16566-1.c, gcc.c-torture/compile/pr16566-2.c, gcc.c-torture/compile/pr16566-3.c: New tests. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.631&r2=2.2326.2.632 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.272.2.9&r2=1.272.2.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.271&r2=1.3389.2.272 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr16566-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr16566-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr16566-3.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed.