Bug 8564 - [3.2 regression] ICE in find_function_data, at function.c:329
Summary: [3.2 regression] ICE in find_function_data, at function.c:329
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2
: P1 critical
Target Milestone: 3.3
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-11-13 11:56 UTC by ron
Modified: 2012-05-11 18:38 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
jj.C (93.26 KB, application/octet-stream)
2003-05-21 15:16 UTC, ron
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ron 2002-11-13 11:56:00 UTC
g++ 3.2 crashes on the attached file

[vaniwaar@vaniwaar-w2k ~]$ g++-3.2 -c jj.C
jj.C: In function `void __static_initialization_and_destruction_0(int, int)':
jj.C:29675: Internal compiler error in find_function_data, at function.c:329
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
g++-3.2 (GCC) 3.2

Environment:
RH Linux 7.3

How-To-Repeat:
Simply compile the attached file
Comment 1 ron 2002-11-13 11:56:00 UTC
Fix:
Please!  :-)
Comment 2 Volker Reichelt 2002-11-14 01:59:16 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    
    The bug can be demonstrated with the following code snippet:
    
    ----------------------------snip here--------------------------
    class A { static char* p; };
    
    int i = 1;
    char* A::p = new char[i];
    
    class B { B(); };
    
    B::B() {}
    ----------------------------snip here--------------------------
    
    This crashes gcc 3.0.x, 3.1 - 3.2.1, and mainline (just compile with
    g++ -c) - with gcc 2.95.x, however, the code compiles fine.
    So this is a regression from 2.95.x.
    
    A workaround is to write "new char[1]" instead of "new char[i]"
    (i.e. replace line 29675 by
      char* SpParmSetDataItem::ret = new char[30];
    in the file jj.C).
Comment 3 Volker Reichelt 2002-11-14 12:21:58 UTC
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, vaniwaar@ca.metsci.com, ron@vaniwaarden.org,
        gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/8564: internal compiler error in find_function_data, at function.c:329 with  g++ 3.2
Date: Thu, 14 Nov 2002 12:21:58 +0100

 Hi,
 
 here's an even shorter example:
 
 ----------------------------snip here--------------------------
 struct A { static char* p; };
 
 int i = 1;
 char* A::p = new char[i];
 
 void foo() {}
 ----------------------------snip here--------------------------
 
 BTW, the same bug was reported in PR 7473.
 
 Greetings,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7473
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8564
 
 

Comment 4 Wolfgang Bangerth 2002-12-12 10:04:47 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/8564
Date: Thu, 12 Dec 2002 10:04:47 -0600 (CST)

 This patchset:
 > 2001-01-03  Jason Merrill  <jason@redhat.com>
 >
 >       * init.c (build_default_init): New fn.
 >       (perform_member_init): Split out from here.
 >       (build_new_1): Use it.  Simplify initialization logic.
 >       (build_vec_init): Take an array, rather than a pointer and maxindex.
 >       Speed up simple initializations.  Don't clean up if we're assigning.
 >       * cp-tree.h: Adjust.
 >       * decl2.c (do_static_initialization): Remove TREE_VEC case.
 >       * parse.y (new_initializer): Return void_zero_node for ().
 >       * typeck.c (build_modify_expr): Handle getting a CONSTRUCTOR.
 >       * typeck2.c (digest_init): Only complain about user-written
 >       CONSTRUCTORs.
 
 is causing high priority regression PR 8564. The testcase for this PR is
 ------------------------
 struct A { static char* p; };
 
 int i = 1;
 char* A::p = new char[i];
 
 void foo() {}
 ------------------------
 
 It fails like so:
 bash-2.05$ ../gcc/bin-2001-01-02/gcc/cc1plus -O -quiet PR8564.cc
 PR8564.cc: In function `void __static_initialization_and_destruction_0(int, int)':
 PR8564.cc:8: Internal compiler error in find_function_data, at function.c:327
 Please submit a full bug report.
  See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 
 

Comment 5 Jason Merrill 2003-01-17 03:43:53 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8564
Date: 17 Jan 2003 03:43:53 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-01-16 19:43:52
 
 Added files:
 	gcc/testsuite/g++.dg/init: new3.C 
 
 Log message:
 	PR c++/8564
 	* init.c (build_vec_init): Re-add maxindex parm.
 	(perform_member_init, build_aggr_init): Pass it.
 	(build_new_1): Pass it. Use an incomplete array type for full_type.
 	* typeck.c (build_modify_expr): Pass it.
 	* cp-tree.h: Adjust.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 6 Jason Merrill 2003-01-17 03:43:53 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8564
Date: 17 Jan 2003 03:43:53 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	jason@gcc.gnu.org	2003-01-16 19:43:53
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h init.c typeck.c 
 
 Log message:
 	PR c++/8564
 	* init.c (build_vec_init): Re-add maxindex parm.
 	(perform_member_init, build_aggr_init): Pass it.
 	(build_new_1): Pass it. Use an incomplete array type for full_type.
 	* typeck.c (build_modify_expr): Pass it.
 	* cp-tree.h: Adjust.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3163&r2=1.3164
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.801&r2=1.802
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.305&r2=1.306
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.444&r2=1.445
 

Comment 7 Jason Merrill 2003-01-17 03:44:10 UTC
From: jason@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/8564
Date: 17 Jan 2003 03:44:10 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	jason@gcc.gnu.org	2003-01-16 19:44:10
 
 Modified files:
 	gcc/cp         : ChangeLog cp-tree.h init.c typeck.c 
 
 Log message:
 	PR c++/8564
 	* init.c (build_vec_init): Re-add maxindex parm.
 	(perform_member_init, build_aggr_init): Pass it.
 	(build_new_1): Pass it. Use an incomplete array type for full_type.
 	* typeck.c (build_modify_expr): Pass it.
 	* cp-tree.h: Adjust.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.17&r2=1.3076.2.18
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.776.2.3&r2=1.776.2.4
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.299&r2=1.299.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.436&r2=1.436.2.1
 

Comment 8 Wolfgang Bangerth 2003-02-19 08:10:46 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: Steven Bosscher <s.bosscher@student.tudelft.nl>
Cc: gcc-gnats@gcc.gnu.org, <gcc-bugs@gcc.gnu.org>, <jason@gcc.gnu.org>
Subject: Re: c++/8564: [3.2/3.3/3.4 regression] ICE in find_function_data,
 at function.c:329
Date: Wed, 19 Feb 2003 08:10:46 -0600 (CST)

 > Can this PR be closed?  Its "sibling" PR 7473 has already been closed
 > and it seems this bug was fixed some time ago, too.
 
 I can confirm that it is fixed on 3.3 and mainline, but it is not fixed on 
 3.2 branch. I'd be happy to close it, but we need agreement that it will 
 not be fixed on 3.2 any more (where it is a regression as well). I have 
 adapted the synposis in the meantime, to reflect this.
 
 Jason, you wrote the fix. Is there any chance of rolling it over to the 
 branch, or is this too invasive?
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 
Comment 9 s.bosscher 2003-02-19 13:13:10 UTC
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
	gcc-prs@gcc.gnu.org
Cc: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Subject: Re: c++/8564: [3.2/3.3/3.4 regression] ICE in find_function_data,
	at function.c:329
Date: 19 Feb 2003 13:13:10 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8564
 
 Can this PR be closed?  Its "sibling" PR 7473 has already been closed
 and it seems this bug was fixed some time ago, too.
 
 The ChangeLog entry for the fix is in cp/ChangeLog, so maybe it was not
 recognised by the "cvs commit" machinery??
 
 Greetz
 Steven
 
 

Comment 10 Joe Buck 2003-04-25 19:41:17 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3 and mainline; 3.2 branch is now closed.
Comment 11 Jorn Wolfgang Rennecke 2005-03-21 19:24:29 UTC
(In reply to comment #7)
>  	* init.c ...
>  	(build_new_1): ... Use an incomplete array type for full_type.

This change has caused PR c++/20427.
The following variant of the reduced testcase also changed from ICE to wrong-code:

 struct A { static char* p; };
 
 int i = 1;
 char* A::p = new char[i] ();
 
 void foo() {}
Comment 12 michael777 2012-05-11 18:38:28 UTC
hi, good work at fixing all these bugs, The bug can be demonstrated with the following code snippet: good coding with what you do here.

this is a good blog if you want to audition for the x factor http://x-factor-2013.blogspot.co.uk