Bug 21873 - [3.4 Regression] infinite warning loop on bad array initializer
[3.4 Regression] infinite warning loop on bad array initializer
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c
3.3.3
: P2 minor
: 3.4.5
Assigned To: Joseph S. Myers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-06-02 01:53 UTC by allans
Modified: 2005-07-28 23:08 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-06-03 23:30:50


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description allans 2005-06-02 01:53:17 UTC
struct foo {
  int a;
  int b;
} bar [1][0] = { 3, 4 };

// warnings continue forever 

s.c:5: warning: excess elements in array initializer
s.c:5: warning: (near initialization for `bar')
s.c:5: warning: excess elements in array initializer
s.c:5: warning: (near initialization for `bar')
gcc: Internal error: Interrupt (program cc1)  // I pressed ctrl-C 
Please submit a full bug report.

Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specs
Configured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr
--exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/l
ib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc,
pascal --enable-nls --without-included-gettext --enable-libgcj
--with-system-zlib --enable-interpreter --enable-threads=
posix --enable-java-gc=boehm --enable-sjlj-exceptions
--disable-version-specific-runtime-libs --disable-win32-registry
Thread model: posix
gcc version 3.3.3 (cygwin special)


Same behaviour on arm-elf-gcc 3.2.1 

Reading specs from /opt/ecos/gnutools/arm-elf/bin/../lib/gcc-lib/arm-elf/3.2.1/specs
Configured with:
/local/demonweb/tools/ecos-gnutools-v1.4/r2/arm-elf/cygwin/tar_bz2/source/gcc-3.2.1/configure
--target
arm-elf
--prefix=/local/demonweb/tools/ecos-gnutools-v1.4/r2/arm-elf/cygwin/tar_bz2/opt/ecos/gnutools/arm-elf
--enable-
anguages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib
--with-gxx-include-dir=/local/demonweb/tools/ecos-gnutools-v1.
/r2/arm-elf/cygwin/tar_bz2/opt/ecos/gnutools/arm-elf/arm-elf/include
Thread model: single
gcc version 3.2.1
Comment 1 Joseph S. Myers 2005-06-03 23:30:49 UTC
Confirmed.  There are lots of related cases which yield infinite loops (with or
without diagnostics).  All versions 3.0.x onwards either loop or ICE on some
such tests; 2.95.3 avoids both (although it doesn't diagnose them all either). 
Testing a patch for mainline and 4.0 branch (probably safe for 3.4 branch as well).
Comment 2 CVS Commits 2005-06-04 01:35:02 UTC
Subject: Bug 21873

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-06-04 01:34:47

Modified files:
	gcc            : ChangeLog c-typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: init-excess-1.c 

Log message:
	PR c/21873
	* c-typeck.c (push_init_level): Don't pop levels without braces if
	implicit == 1.
	
	testsuite:
	* gcc.dg/init-excess-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9031&r2=2.9032
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.447&r2=1.448
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5588&r2=1.5589
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/init-excess-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 3 CVS Commits 2005-06-04 01:44:37 UTC
Subject: Bug 21873

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jsm28@gcc.gnu.org	2005-06-04 01:44:30

Modified files:
	gcc            : ChangeLog c-typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: init-excess-1.c 

Log message:
	PR c/21873
	* c-typeck.c (push_init_level): Don't pop levels without braces if
	implicit == 1.
	
	testsuite:
	* gcc.dg/init-excess-1.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.276&r2=2.7592.2.277
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.419.2.5&r2=1.419.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.223&r2=1.5084.2.224
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/init-excess-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 4 CVS Commits 2005-07-28 22:56:22 UTC
Subject: Bug 21873

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	jsm28@gcc.gnu.org	2005-07-28 22:56:03

Modified files:
	gcc            : ChangeLog c-typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: init-excess-1.c 

Log message:
	PR c/21873
	* c-typeck.c (push_init_level): Don't pop levels without braces if
	implicit == 1.
	
	testsuite:
	* gcc.dg/init-excess-1.c: New test.

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.888&r2=2.2326.2.889
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.13&r2=1.272.2.14
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.413&r2=1.3389.2.414
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/init-excess-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.18.1

Comment 5 Joseph S. Myers 2005-07-28 23:08:23 UTC
Now fixed on 3.4 branch.