Bug 54844 - [4.8 Regression] ice tsubst_copy, at cp/pt.c:12352
Summary: [4.8 Regression] ice tsubst_copy, at cp/pt.c:12352
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Jakub Jelinek
URL:
Keywords:
: 54927 54994 54999 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-07 09:45 UTC by David Binderman
Modified: 2012-10-24 09:51 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-10-08 00:00:00


Attachments
gzipped C++ source code (175.16 KB, application/x-gzip)
2012-10-07 09:45 UTC, David Binderman
Details
gcc48-pr54844.patch (690 bytes, patch)
2012-10-15 10:15 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2012-10-07 09:45:38 UTC
Created attachment 28379 [details]
gzipped C++ source code

The original source code I provided for bug #46240 seems to 
now cause an ice.

oct-norm.cc: In instantiation of ‘R vector_norm(const MArray<T>&, R) [with T = double; R = double]’:
oct-norm.cc:521:75:   required from here
oct-norm.cc:309:234: internal compiler error: in tsubst_copy, at cp/pt.c:12352
0x58361a tsubst_copy
    ../../src/trunk/gcc/cp/pt.c:12352
0x5745c2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
    ../../src/trunk/gcc/cp/pt.c:13479
0x57321c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
    ../../src/trunk/gcc/cp/pt.c:13504
0x574139 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
    ../../src/trunk/gcc/cp/pt.c:13459
0x5736c9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
    ../../src/trunk/gcc/cp/pt.c:13863
0x57aa9a tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:13159
0x57b61a tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12792
0x57b6ce tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12814
0x57c56d tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12800
0x57b6ce tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12814
0x57c56d tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12800
0x57b753 tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12630
0x57b6ce tsubst_expr
    ../../src/trunk/gcc/cp/pt.c:12814
0x579966 instantiate_decl(tree_node*, int, bool)
    ../../src/trunk/gcc/cp/pt.c:18635
0x5b3e33 instantiate_pending_templates(int)
    ../../src/trunk/gcc/cp/pt.c:18734
0x5ee1ae cp_write_global_declarations()
    ../../src/trunk/gcc/cp/decl2.c:3742
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

No special compiler flags required.

This code used to compile with trunk dated 2012 Oct 03, so 
a recent change seems to be causing the problem.
Comment 1 Markus Trippelsdorf 2012-10-07 11:32:20 UTC
template<class>class A {};

class B : public A<double>{};

template<class T, class R>
void
vector_norm(A<T>, R)
{
  sizeof(float) ? : 0;
}
void
xnorm(B& p1)
{
  vector_norm(p1, 0);
}
Comment 2 Richard Biener 2012-10-08 12:04:24 UTC
Confirmed.
Comment 3 Paolo Carlini 2012-10-08 12:10:26 UTC
REAL_TYPE remains unhandled in tsubst_copy. First blush however, I'm not sure if we shouldn't be passing REAL_TYPEs at all, or it's just a trivial matter of adding to the switch.
Comment 4 Paolo Carlini 2012-10-14 22:50:10 UTC
*** Bug 54927 has been marked as a duplicate of this bug. ***
Comment 5 Paolo Carlini 2012-10-14 23:23:00 UTC
Jakub, can you have a look to this? Seems related to your sizeof changes.
Comment 6 Jakub Jelinek 2012-10-15 10:15:06 UTC
Created attachment 28449 [details]
gcc48-pr54844.patch

Untested fix.
Comment 7 Wolfgang Bangerth 2012-10-20 02:23:30 UTC
May be related to PR 54994.
Comment 8 Jakub Jelinek 2012-10-20 06:55:45 UTC
*** Bug 54994 has been marked as a duplicate of this bug. ***
Comment 9 vincenzo Innocente 2012-10-20 15:26:03 UTC
*** Bug 54999 has been marked as a duplicate of this bug. ***
Comment 10 Wolfgang Bangerth 2012-10-22 11:58:58 UTC
Given that this bug has been found 3 times already (and I extracted my testcase from the widely used BOOST library), is there an ETA for a fix?
W.
Comment 11 Jakub Jelinek 2012-10-22 12:03:45 UTC
It has been fixed a week ago: http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01538.html
but the patch hasn't been reviewed yet.  I'll ping it today.
Comment 12 Wolfgang Bangerth 2012-10-22 13:05:36 UTC
Thanks, Jakub!
Comment 13 Jakub Jelinek 2012-10-23 18:05:03 UTC
Author: jakub
Date: Tue Oct 23 18:04:55 2012
New Revision: 192736

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192736
Log:
	PR c++/54844
	* pt.c (tsubst_copy, tsubst_copy_and_build) <case SIZEOF_EXPR>: Use
	tsubst instead of tsubst_copy* on types.

	* g++.dg/template/sizeof14.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/sizeof14.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 14 Jakub Jelinek 2012-10-24 09:51:47 UTC
Fixed.