Bug 27801 - [4.0 regression] ICE in invert_truthvalue with template
Summary: [4.0 regression] ICE in invert_truthvalue with template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.1.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-05-29 20:29 UTC by Volker Reichelt
Modified: 2007-02-03 17:26 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.2 4.2.0
Known to fail: 4.1.1 4.0.3
Last reconfirmed: 2006-09-03 21:39:58


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-05-29 20:29:54 UTC
The following valid code snippet causes an ICE since GCC 3.4.0:

====================================
template<int> int foo(int i)
{
  return !( (1 && i) ? 0 : 1 );
}
====================================

bug.cc: In function 'int foo(int)':
bug.cc:3: internal compiler error: in invert_truthvalue, at fold-const.c:3165
Please submit a full bug report, [etc.]
Comment 1 Wolfgang Bangerth 2006-05-31 02:23:06 UTC
Confirmed
Comment 2 Mark Mitchell 2006-05-31 20:03:24 UTC
Subject: Bug 27801

Author: mmitchel
Date: Wed May 31 20:03:12 2006
New Revision: 114278

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114278
Log:
	PR c++/27801
	* call.c (perform_implicit_conversion): Do not actually perform
	conversions in templates.
	PR c++/26496
	* call.c (resolve_args): Check for invalid uses of bound
	non-static member functions.
	* init.c (build_offset_ref): Return error_mark_node for errors.
	PR c++/27385
	* decl.c (reshape_init): Robustify.
	(reshape_init_array_1): Likewise.
	PR c++/27801
	* g++.dg/template/cond6.C: New test.
	PR c++/26496
	* g++.dg/template/crash51.C: New test.
	* g++.old-deja/g++.mike/net36.C: Tweak error markers.
	PR c++/27385
	* g++.dg/init/array20.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/init/array20.C
    trunk/gcc/testsuite/g++.dg/template/cond6.C
    trunk/gcc/testsuite/g++.dg/template/crash51.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.old-deja/g++.mike/net36.C

Comment 3 Mark Mitchell 2006-05-31 20:03:46 UTC
Subject: Bug 27801

Author: mmitchel
Date: Wed May 31 20:03:27 2006
New Revision: 114279

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114279
Log:
	PR c++/27801
	* call.c (perform_implicit_conversion): Do not actually perform
	conversions in templates.
	PR c++/26496
	* call.c (resolve_args): Check for invalid uses of bound
	non-static member functions.
	* init.c (build_offset_ref): Return error_mark_node for errors.
	PR c++/27385
	* decl.c (reshape_init): Robustify.
	(reshape_init_array_1): Likewise.
	PR c++/27801
	* g++.dg/template/cond6.C: New test.
	PR c++/26496
	* g++.dg/template/crash51.C: New test.
	* g++.old-deja/g++.mike/net36.C: Tweak error markers.
	PR c++/27385
	* g++.dg/init/array20.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/init/array20.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/cond6.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/crash51.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/call.c
    branches/gcc-4_1-branch/gcc/cp/decl.c
    branches/gcc-4_1-branch/gcc/cp/init.c
    branches/gcc-4_1-branch/gcc/testsuite/g++.old-deja/g++.mike/net36.C

Comment 4 Mark Mitchell 2006-05-31 20:08:46 UTC
Subject: Bug 27801

Author: mmitchel
Date: Wed May 31 20:07:35 2006
New Revision: 114280

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114280
Log:
	PR c++/27801
	* call.c (perform_implicit_conversion): Do not actually perform
	conversions in templates.
	PR c++/26496
	* call.c (resolve_args): Check for invalid uses of bound
	non-static member functions.
	* init.c (build_offset_ref): Return error_mark_node for errors.
	PR c++/27385
	* decl.c (reshape_init): Robustify.
	(reshape_init_array_1): Likewise.
	PR c++/27801
	* g++.dg/template/cond6.C: New test.
	PR c++/26496
	* g++.dg/template/crash51.C: New test.
	* g++.old-deja/g++.mike/net36.C: Tweak error markers.
	PR c++/27385
	* g++.dg/init/array20.C: New test.

Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 5 Mark Mitchell 2006-05-31 20:11:56 UTC
Fixed in 4.1.2, 4.2.0.
Comment 6 Gabriel Dos Reis 2007-02-03 17:26:05 UTC
Fixed in GCC-4.1.2.