Bug 34573 - [4.3 Regression] ICE with nested class in template
Summary: [4.3 Regression] ICE with nested class in template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P1 blocker
Target Milestone: 4.3.0
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 34846
  Show dependency treegraph
 
Reported: 2007-12-24 15:58 UTC by Sylvain Pion
Modified: 2008-01-22 14:56 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.3
Known to fail:
Last reconfirmed: 2008-01-21 23:16:32


Attachments
pre-processed test case (321.86 KB, application/octet-stream)
2007-12-24 16:00 UTC, Sylvain Pion
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Pion 2007-12-24 15:58:57 UTC
The attached preprocessed source ICEs with current g++ 4.3 :

../../include/CGAL/Visibility_complex_2/Antichain.h:1394: internal compiler error: Bus error

I really believe the code is valid, as it works with older g++ releases
(although the preprocessed code attached does not, but it is due to
library changes).

I quickly tried to extract a reduced test case but failed, and prefer
to submit a report soon.
Comment 1 Sylvain Pion 2007-12-24 16:00:30 UTC
Created attachment 14819 [details]
pre-processed test case
Comment 2 Andrew Pinski 2007-12-24 22:19:03 UTC
The backtrace:
#0  0x00dec6b0 in htab_find_with_hash (htab=0x0, element=0x546c9a0, hash=11065652) at /Users/apinski/src/local/gcc/libiberty/hashtab.c:566
#1  0x00080f13 in retrieve_local_specialization (tmpl=0x546c9a0) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:980
#2  0x000c71f7 in tsubst (t=0x546ca10, args=0x64ca580, complain=tf_warning_or_error, in_decl=0x547a120) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:8824
#3  0x000c732a in tsubst (t=0x5478540, args=0x64ca580, complain=tf_warning_or_error, in_decl=0x547a120) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:8844
#4  0x000c299e in tsubst_decl (t=0x547a120, args=0x64ca580, complain=tf_warning_or_error) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:8224
#5  0x000c6882 in tsubst (t=0x547a120, args=0x64ca580, complain=tf_warning_or_error, in_decl=0x547a120) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:8799
#6  0x000c318b in tsubst_decl (t=0x547a300, args=0x64ca580, complain=tf_warning_or_error) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:8260
#7  0x000c6882 in tsubst (t=0x547a300, args=0x64ca580, complain=tf_warning_or_error, in_decl=0x64cb000) at /Users/apinski/src/local/gcc/gcc/cp/pt.c:8799
#8  0x001026e1 in instantiate_decl (d=0x64cb000, defer_ok=0, expl_inst_class_mem_p=0 '\0') at /Users/apinski/src/local/gcc/gcc/cp/pt.c:14786
Comment 3 Andrew Pinski 2007-12-25 23:40:53 UTC
Reduced testcase:
template < class Gtr_>
void compute_gr()
{
  typedef int Less_chain;
  struct utils {
    utils(const Less_chain& lc)  {};
  };
  utils U(1);
}
int main(void){
  compute_gr<int>();
}

Comment 4 Andrew Pinski 2007-12-25 23:42:40 UTC
Changing compute_gr to a non template, it works.

Using int instead of the typedef, it also works.
Comment 5 Jakub Jelinek 2008-01-03 18:09:24 UTC
Related to PR19407 I guess.  CCing Jason.
Comment 6 Jason Merrill 2008-01-22 14:48:55 UTC
Subject: Bug 34573

Author: jason
Date: Tue Jan 22 14:48:05 2008
New Revision: 131724

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131724
Log:
        PR c++/33959
        * pt.c (tsubst_aggr_type): Make sure our context is complete.

        PR c++/34573
        * pt.c (retrieve_local_specialization): Robustify.
        (tsubst_pack_expansion, tsubst_decl): Remove redundant checks.

        PR c++/34846
        * pt.c (tsubst): Only call retrieve_local_specialization if the
        original typedef was in a function template.

Added:
    trunk/gcc/testsuite/g++.dg/template/nested5.C
    trunk/gcc/testsuite/g++.dg/template/typedef10.C
    trunk/gcc/testsuite/g++.dg/template/typedef9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c

Comment 7 Jakub Jelinek 2008-01-22 14:56:12 UTC
Fixed.