Bug 16042 - [3.4 regression] ICE with array assignment
Summary: [3.4 regression] ICE with array assignment
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.6
Assignee: Gabriel Dos Reis
URL:
Keywords: ice-on-invalid-code
: 17179 19640 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-17 23:39 UTC by Joseph Heled
Modified: 2006-02-28 09:30 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3
Known to fail: 3.3.4
Last reconfirmed: 2006-01-06 15:26:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Heled 2004-06-17 23:39:06 UTC
Code:

int
main(int ac, char** av)
{
  int to[6] = (int[6]){-1,-1,-1,-1,-1,-1};

  return 0;
}

$uname -a
Linux yoda 2.4.18-18.8.0 #1 Wed Nov 13 22:52:09 EST 2002 i686 athlon i386 GNU/Linux

g++ -v  -o m.o  -c m.cc
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../gcc-3.4.0/configure --enable-languafes=c,c++
Thread model: posix
gcc version 3.4.0
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -quiet -v -D_GNU_SOURCE
m.cc -quiet -dumpbase m.cc -mtune=pentiumpro -auxbase-strip m.o -version -o
/tmp/ccUaqwp3.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/i686-pc-linux-gnu
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../include/c++/3.4.0/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/include
 /usr/include
End of search list.
GNU C++ version 3.4.0 (i686-pc-linux-gnu)
	compiled by GNU C version 3.4.0.
GGC heuristics: --param ggc-min-expand=45 --param ggc-min-heapsize=29906
m.cc: In function `int main(int, char**)':
m.cc:5: 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.

Compilation exited abnormally with code 1 at Fri Jun 18 11:37:10
Comment 1 Andrew Pinski 2004-06-17 23:46:24 UTC
On the mainline, it errors out:
tin:~/src/gnu/gcctest>gcc pr16042.cc
pr16042.cc: In function `int main(int, char**)':
pr16042.cc:4: error: invalid initializer
Comment 2 Wolfgang Bangerth 2004-06-18 13:28:23 UTC
This is a regression in 3.3 and 3.4 which ICE, over 3.2 which doesn't: 
 
g/x> /home/bangerth/bin/gcc-3.2.3/bin/c++ -c x.cc 
 
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc 
x.cc: In function `int main(int, char**)': 
x.cc:4: internal compiler error: tree check: expected tree_list, have  
   constructor in reshape_init, at cp/decl.c:8408 
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.4-pre/bin/c++ -c x.cc 
x.cc: In function `int main(int, char**)': 
x.cc:4: internal compiler error: tree check: expected tree_list, have 
constructor in reshape_init, at cp/decl.c:4373 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
Mainline indeed doesn't ICE, but reports 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc: In function `int main(int, char**)': 
x.cc:4: error: invalid initializer 
 
This does seem sensible to me, since my understanding is that tha 
  (compound-type){initializer-list} 
syntax is only C99, but not part of the C++ standard. 
 
In any case, the ICE in 3.3 and 3.4 is a regression. 
 
W. 
Comment 3 Andrew Pinski 2004-07-29 15:15:42 UTC
Fixed on the mainline
: Search converges between 2004-04-20-trunk (#449) and 2004-05-01-trunk (#450).

Broke
: Search converges between 2003-06-03-trunk (#253) and 2003-06-04-trunk (#254).
Comment 4 Mark Mitchell 2004-08-02 06:43:19 UTC
I'm going to leave this open, but remove the target milestone.  Given that it's
an ICE-on-invalid and the fact that it's already fixed in the mainline, this is
not a showstopper.
Comment 5 Giovanni Bajo 2004-08-02 11:29:14 UTC
Do we support compound initializers in C++?
Comment 6 Gabriel Dos Reis 2004-08-02 11:46:54 UTC
Subject: Re:  [3.3/3.4 regression] ICE with array assignment

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:

| Do we support compound initializers in C++?

To the extent where we support most C99 constructs, yes. (Note that
those were GNU extensions when they started).

"compound initializers" are being formalized as "generalized initializer
lists" by the C++ Evolution Group.

-- Gaby
Comment 7 Andrew Pinski 2004-08-25 04:54:44 UTC
*** Bug 17179 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2005-01-26 14:11:48 UTC
Actually this was accepted for 3.2.3 (and earlier versions of 3.3.x)

The ICE started: Search converges between 2003-06-03-trunk (#253) and 2003-06-04-trunk (#254).
But note 3.3.3 produced wrong code but 3.3.1 produced correct code.

3.3.x regressed between 20040128 and 20040201.

Comment 9 Andrew Pinski 2005-01-26 14:12:25 UTC
*** Bug 19640 has been marked as a duplicate of this bug. ***
Comment 10 Mark Mitchell 2005-01-31 01:30:12 UTC
In GCC 4.0, there is no defect.  This code is of course invalid C++.  It is not
accepted in GNU C99 mode, so there is no reason to accept it in GNU C++.  I have
therefore removed the 4.0 regression markers.
Comment 11 Mark Mitchell 2005-04-29 18:36:55 UTC
This is invalid code, so removed rejects-valid marker.
Comment 12 Gabriel Dos Reis 2006-02-28 09:30:57 UTC
won't fix in 3.4.6