public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460
@ 2005-07-27 19:03 dank at kegel dot com
  2005-07-27 19:11 ` [Bug c++/23099] [4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dank at kegel dot com @ 2005-07-27 19:03 UTC (permalink / raw)
  To: gcc-bugs

The following test case:
------------------------------------------------------------
struct Base {
  int x;
};

template <typename T>
struct A {
  static const int N = sizeof(static_cast<Base*>(T()));
};

struct Derived : Base {
  A<Derived*> a;
};
------------------------------------------------------------ 

gcc 2.95.3: compiles

gcc 3.4.4: compiles

gcc 4.0.1: ICE
b1.cc: In instantiation of 'A<Derived*>':
b1.cc:11:   instantiated from here
b1.cc:7: internal compiler error: in build_simple_base_path, at cp/class.c:459

gcc-4.1-20050716: ICE     
bug.cc: In instantiation of 'A<Derived*>':
bug.cc:11:   instantiated from here
bug.cc:7: internal compiler error: in build_simple_base_path, at cp/class.c:460

gcc CVS 2005-07-25: ICE
b1.cc: In instantiation of 'A<Derived*>':
b1.cc:11:   instantiated from here
b1.cc:7: internal compiler error: in build_simple_base_path, at cp/class.c:461

Thanks to mec for uncovering this, and bgibbons for minimizing the
test case.

-- 
           Summary: [4.0 regression] ICE in build_simple_base_path, at
                    cp/class.c:460
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dank at kegel dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/23099] [4.0/4.1 regression] ICE in build_simple_base_path, at cp/class.c:460
  2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
@ 2005-07-27 19:11 ` pinskia at gcc dot gnu dot org
  2005-08-28 18:11 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-27 19:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-27 19:03 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-27 19:03:08
               date|                            |
            Summary|[4.0 regression] ICE in     |[4.0/4.1 regression] ICE in
                   |build_simple_base_path, at  |build_simple_base_path, at
                   |cp/class.c:460              |cp/class.c:460
   Target Milestone|---                         |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/23099] [4.0/4.1 regression] ICE in build_simple_base_path, at cp/class.c:460
  2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
  2005-07-27 19:11 ` [Bug c++/23099] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-08-28 18:11 ` mmitchel at gcc dot gnu dot org
  2005-08-28 19:43 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-08-28 18:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/23099] [4.0/4.1 regression] ICE in build_simple_base_path, at cp/class.c:460
  2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
  2005-07-27 19:11 ` [Bug c++/23099] [4.0/4.1 " pinskia at gcc dot gnu dot org
  2005-08-28 18:11 ` mmitchel at gcc dot gnu dot org
@ 2005-08-28 19:43 ` mmitchel at gcc dot gnu dot org
  2005-08-29 13:58 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-08-28 19:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-08-28 18:11 -------
The fundamental problem here is that G++ is not honoring [temp.inst], which
requires that:

"in particular, the initialization (and any associated side-effects) of a static
data member does not occur unless the static data member is itself used in a way
that requires the definition of the static data member to exist."

It is instead performing the initialization immediately when instantiating
"A<Derived*>".  I am looking into the issue.





-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/23099] [4.0/4.1 regression] ICE in build_simple_base_path, at cp/class.c:460
  2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
                   ` (2 preceding siblings ...)
  2005-08-28 19:43 ` mmitchel at gcc dot gnu dot org
@ 2005-08-29 13:58 ` cvs-commit at gcc dot gnu dot org
  2005-08-29 14:53 ` cvs-commit at gcc dot gnu dot org
  2005-08-29 14:57 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-29 13:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-29 13:56 -------
Subject: Bug 23099

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	mmitchel@gcc.gnu.org	2005-08-29 13:56:48

Modified files:
	gcc/cp         : cp-tree.h decl.c init.c name-lookup.c pt.c 
	                 ChangeLog 
	gcc/testsuite/g++.dg/init: member1.C 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: static13.C static14.C 

Log message:
	PR c++/23099
	* cp-tree.h (saved_scope): Add skip_evaluation.
	* decl.c (start_decl): Use DECL_INITIALIZED_IN_CLASS_P, not
	DECL_INITIAL, to determine whether or not a static data member was
	initialized in the class-specifier.
	(cp_finish_decl): Add comment.
	* init.c (integral_constant_value): Subtitute into the
	initializers for static data members in	templates.
	* name-lookup.c (push_to_top_level): Save skip_evaluation.
	(pop_from_top_level): Restore it.
	* pt.c (instantiate_class_template): Do not substitute into the
	intializers of static data members when instantiating a class.
	(regenerate_decl_from_template): Simplify.
	(instantiate_decl): Tidy.  Substitute into the initializer for a
	static data member even when the definition of the data member is
	not available.
	
	PR c++/23099
	* g++.dg/init/member1.C: Make sure erroneous static data member
	definitions are required.
	* g++.dg/template/static13.C: New test.
	* g++.dg/template/static14.C: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1106.2.12&r2=1.1106.2.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1371.2.19&r2=1.1371.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.412.2.7&r2=1.412.2.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.109.4.6&r2=1.109.4.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.978.2.19&r2=1.978.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.84&r2=1.4648.2.85
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/member1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.10.1&r2=1.1.10.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static13.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static14.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
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.358&r2=1.5084.2.359



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/23099] [4.0/4.1 regression] ICE in build_simple_base_path, at cp/class.c:460
  2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
                   ` (3 preceding siblings ...)
  2005-08-29 13:58 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-29 14:53 ` cvs-commit at gcc dot gnu dot org
  2005-08-29 14:57 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-29 14:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-29 14:15 -------
Subject: Bug 23099

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-08-29 14:09:08

Modified files:
	gcc/cp         : cp-tree.h decl.c init.c name-lookup.c pt.c 
	                 ChangeLog 
	gcc/testsuite/g++.dg/init: member1.C 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: static13.C static14.C 

Log message:
	PR c++/23099
	* cp-tree.h (saved_scope): Add skip_evaluation.
	* decl.c (start_decl): Use DECL_INITIALIZED_IN_CLASS_P, not
	DECL_INITIAL, to determine whether or not a static data member was
	initialized in the class-specifier.
	(cp_finish_decl): Add comment.
	* init.c (integral_constant_value): Subtitute into the
	initializers for static data members in	templates.
	* name-lookup.c (push_to_top_level): Save skip_evaluation.
	(pop_from_top_level): Restore it.
	* pt.c (instantiate_class_template): Do not substitute into the
	intializers of static data members when instantiating a class.
	(regenerate_decl_from_template): Simplify.
	(instantiate_decl): Tidy.  Substitute into the initializer for a
	static data member even when the definition of the data member is
	not available.
	
	PR c++/23099
	* g++.dg/init/member1.C: Make sure erroneous static data member
	definitions are required.
	* g++.dg/template/static13.C: New test.
	* g++.dg/template/static14.C: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1159&r2=1.1160
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1420&r2=1.1421
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.427&r2=1.428
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.137&r2=1.138
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1026&r2=1.1027
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4861&r2=1.4862
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/member1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static13.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static14.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5976&r2=1.5977



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/23099] [4.0/4.1 regression] ICE in build_simple_base_path, at cp/class.c:460
  2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
                   ` (4 preceding siblings ...)
  2005-08-29 14:53 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-29 14:57 ` mmitchel at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-08-29 14:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-08-29 14:18 -------
Fixed in 4.0.2.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23099


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-29 14:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-27 19:03 [Bug c++/23099] New: [4.0 regression] ICE in build_simple_base_path, at cp/class.c:460 dank at kegel dot com
2005-07-27 19:11 ` [Bug c++/23099] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-08-28 18:11 ` mmitchel at gcc dot gnu dot org
2005-08-28 19:43 ` mmitchel at gcc dot gnu dot org
2005-08-29 13:58 ` cvs-commit at gcc dot gnu dot org
2005-08-29 14:53 ` cvs-commit at gcc dot gnu dot org
2005-08-29 14:57 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).