Bug 9559 - [3.3/3.4 regression] ICE with invalid initialization of a static const member
Summary: [3.3/3.4 regression] ICE with invalid initialization of a static const member
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: 3.3.1
Assignee: Mark Mitchell
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2003-02-03 23:46 UTC by dv
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-06-23 12:52:35


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dv 2003-02-03 23:46:00 UTC
	ICE for the definition of a static const member that was initialized
	inside the class with an unknown identifier.

Release:
3.4 20030203 (experimental)

Environment:
System: Linux dwarf 2.4.3-XFS #7 Mon Aug 6 18:43:20 CEST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /pdsrc/gcc/cvs/gcc/configure --program-suffix=-test --prefix=/local/gcc-test --enable-shared --enable-threads=posix --enable-version-specific-runtime-libs --enable-languages=c,c++

How-To-Repeat:
	See attached code.

test code:
namespace N
{
enum E { max = 5 };
} // N

class A
{
public:
    static const N::E size = max;
    int table[size];
};
const N::E A::size;


int
main()
{
    A a;

    return 0;
}
Comment 1 Wolfgang Bangerth 2003-02-03 23:52:54 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. A shorter testcase is
    -----------------
    struct A {
        static const int size = BOGUS;
    };
    const int A::size;
    ----------------------
    tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
    x.cc:2: error: `BOGUS' was not declared in this scope
    x.cc:4: internal compiler error: Segmentation fault
    
    It's a mainline regression, 3.3 just gives a reasonable
    error.
    
    W.
Comment 2 Giovanni Bajo 2003-05-01 21:03:53 UTC
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>,
	<dv@vollmann.ch>,
	<gcc-prs@gcc.gnu.org>
Cc:  
Subject: Re: c++/9559: [3.4 regression] ICE with invalid initialization of a static const member
Date: Thu, 1 May 2003 21:03:53 +0200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9559
 
 With 3.3 CVS 20030421 and 3.4 CVS 20030430 I get an ICE on the minimal
 snippet. I will update the synopsis to reflect the regression on the 3.3
 branch as well (3.2 does not ICE).
 
 Giovanni Bajo
Comment 3 Andrew Pinski 2003-06-23 16:25:05 UTC
Moving target back to 3.3.1.
Comment 4 GCC Commits 2003-07-01 07:17:06 UTC
Subject: Bug 9559

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-07-01 07:17:03

Modified files:
	gcc/cp         : ChangeLog decl2.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: static1.C 

Log message:
	PR c++/9559
	* decl2.c (grokfield): Do not build NOP_EXPRs around the
	error_mark_node.
	
	PR c++/9559
	* g++.dg/init/static1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3473&r2=1.3474
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.632&r2=1.633
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2821&r2=1.2822
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/static1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 GCC Commits 2003-07-01 07:18:28 UTC
Subject: Bug 9559

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	mmitchel@gcc.gnu.org	2003-07-01 07:18:26

Modified files:
	gcc/cp         : ChangeLog decl2.c 
	gcc/testsuite  : ChangeLog 

Log message:
	PR c++/9559
	* decl2.c (grokfield): Do not build NOP_EXPRs around the
	error_mark_node.
	
	PR c++/9559
	* g++.dg/init/static1.C: New test.

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.169&r2=1.3076.2.170
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.575.2.30&r2=1.575.2.31
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.209&r2=1.2261.2.210

Comment 6 Mark Mitchell 2003-07-01 07:20:38 UTC
Fixed in GCC 3.3.1, GCC 3.4.
Comment 7 GCC Commits 2003-07-02 01:53:49 UTC
Subject: Bug 9559

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	mmitchel@gcc.gnu.org	2003-07-02 01:53:45

Added files:
	gcc/testsuite/g++.dg/init: static1.C 

Log message:
	PR c++/9559
	* g++.dg/init/static1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/static1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1