Bug 19004 - [3.4 Regression] ICE in uses_template_parms at cp/pt.c:4860
Summary: [3.4 Regression] ICE in uses_template_parms at cp/pt.c:4860
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.4
: P2 normal
Target Milestone: 3.4.5
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-invalid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2004-12-15 10:40 UTC by Debian GCC Maintainers
Modified: 2005-09-03 19:59 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.2 4.1.0
Known to fail: 3.4.4 4.0.0
Last reconfirmed: 2005-07-15 21:39:11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2004-12-15 10:40:32 UTC
[forwarded from http://bugs.debian.org/284777]

seen with 3.4 branch 20041215 and CVS HEAD, works with 3.3 CVS branch

$ g++-3.4 bug-284777.cc
bug-284777.cc: In member function `void Dummy<T>::tester()':
bug-284777.cc:13: internal compiler error: in uses_template_parms, at cp/pt.c:4860
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

template<typename T>
struct Dummy
{
  void evil()
  {
    this->template tester<true>();
  }
	    
  template<bool B>
  void tester()
  {
    // evil should actually be a bool  
    bar<evil>()();
  }
  template<bool B>
  struct bar
  {
    void operator()()
    { }
  };
};

int main()
{}
Comment 1 Andrew Pinski 2004-12-15 13:45:20 UTC
: Search converges between 2003-07-15-trunk (#295) and 2003-07-16-trunk (#296).
Comment 2 Kriang Lerdsuwanakij 2004-12-15 15:30:48 UTC
Looking at it.
Comment 3 Kriang Lerdsuwanakij 2004-12-16 14:55:32 UTC
This should be ice-on-invalid-code.  The code:

    bar<evil>()();

must be replaced with:

    bar<&Dummy::evil>()();

because 'evil' alone is not a valid pointer-to-member function.
GCC compiles file with the corrected code.
Comment 4 Volker Reichelt 2004-12-23 16:39:11 UTC
Well, it's not really a regression, since GCC accepted the code before 3.4.0.
Comment 5 Volker Reichelt 2005-02-02 01:45:23 UTC
Fixed for gcc 4.0.0.
Comment 6 Volker Reichelt 2005-02-02 01:46:03 UTC
So closing now.
Comment 7 Volker Reichelt 2005-02-23 10:23:40 UTC
The problem reappeared today :-(
Comment 8 Andrew Pinski 2005-07-15 21:39:11 UTC
(In reply to comment #4)
> Well, it's not really a regression, since GCC accepted the code before 3.4.0.

Even though we acceted it before 3.4.0, this is a regression in that we should not change anything to an 
ICE.
Comment 9 Andrew Pinski 2005-07-22 21:13:13 UTC
Moving to 4.0.2 pre Mark.
Comment 10 GCC Commits 2005-08-26 19:35:49 UTC
Subject: Bug 19004

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-08-26 19:35:13

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: nontype13.C 

Log message:
	PR c++/19004
	* pt.c (uses_template_parms): Handle IDENTIFIER_NODE.
	(type_dependent_expression_p): Allow BASELINKs whose associated
	functions are simply a FUNCTION_DECL.
	
	PR c++/19004
	* g++.dg/template/nontype13.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4860&r2=1.4861
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1025&r2=1.1026
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5965&r2=1.5966
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/nontype13.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 11 Mark Mitchell 2005-08-26 19:38:34 UTC
Fixed in GCC 4.0.2.
Comment 12 GCC Commits 2005-08-26 19:38:34 UTC
Subject: Bug 19004

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	mmitchel@gcc.gnu.org	2005-08-26 19:37:52

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog cp-tree.h init.c pt.c typeck.c 
	gcc/testsuite/g++.dg/expr: anew1.C anew2.C anew3.C 
Added files:
	gcc/testsuite/g++.dg/init: new14.C 
	gcc/testsuite/g++.dg/template: nontype13.C 

Log message:
	PR c++/19004
	* pt.c (uses_template_parms): Handle IDENTIFIER_NODE.
	(type_dependent_expression_p): Allow BASELINKs whose associated
	functions are simply a FUNCTION_DECL.
	
	PR c++/23491
	* cp-tree.h (build_vec_init): Adjust prototype.
	* init.c (perform_member_init): Adjust call to build_vec_init.
	(build_aggr_init): Likewise.
	(build_new_1): Do not call build_default_init for array types.
	(build_vec_init): Add explicit_default_init_p parameter.  Perform
	default initialization of vector elements when set.
	* typeck.c (build_modify_expr): Adjust call to build_vec_init.
	
	PR c++/19004
	* g++.dg/template/nontype13.C: New test.
	
	PR c++/23491
	* g++.dg/init/new14.C: New test.
	* g++.dg/expr/anew1.C: Do not XFAIL.
	* g++.dg/expr/anew2.C: Likewise.
	* g++.dg/expr/anew3.C: Likewise.

Patches:
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.351&r2=1.5084.2.352
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.83&r2=1.4648.2.84
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.11&r2=1.1106.2.12
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.6&r2=1.412.2.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.18&r2=1.978.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.616.2.14&r2=1.616.2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/new14.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/expr/anew1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.42.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/anew2.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.42.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/anew3.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.42.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/nontype13.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 13 Volker Reichelt 2005-09-02 13:40:33 UTC
Taking care of the backport to the 3.4 branch.
Comment 14 GCC Commits 2005-09-03 19:53:08 UTC
Subject: Bug 19004

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	reichelt@gcc.gnu.org	2005-09-03 19:53:01

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: nontype13.C 

Log message:
	Backport:
	
	2005-08-26  Mark Mitchell  <mark@codesourcery.com>
	PR c++/19004
	* pt.c (uses_template_parms): Handle IDENTIFIER_NODE.
	(type_dependent_expression_p): Allow BASELINKs whose associated
	functions are simply a FUNCTION_DECL.
	
	* g++.dg/template/nontype13.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.238&r2=1.3892.2.239
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.59&r2=1.816.2.60
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.431&r2=1.3389.2.432
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/nontype13.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.10.1

Comment 15 Volker Reichelt 2005-09-03 19:59:15 UTC
Fixed also on the 3.4 branch.