Bug 57658 - [4.9 Regression] ICE in tsubst_copy, at cp/pt.c:12213
Summary: [4.9 Regression] ICE in tsubst_copy, at cp/pt.c:12213
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Jason Merrill
URL:
Keywords: c++-lambda
Depends on:
Blocks: lambdas
  Show dependency treegraph
 
Reported: 2013-06-20 10:41 UTC by Takaki Makino
Modified: 2022-03-11 00:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-06-20 00:00:00


Attachments
Reduced testcase (156 bytes, text/plain)
2013-06-21 18:09 UTC, Takaki Makino
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Takaki Makino 2013-06-20 10:41:23 UTC
Maybe similar to PR 57109, but the attached source for the PR was compiled without problem in my environment, so I post this one as a new bug.

Due to bugzilla size limit, I had to compress the preprocessed source with lzma.
If you need, please download the uncompressed version at
http://www.sat.t.u-tokyo.ac.jp/~mak/temp/parser.cpp.1.ii

$ g++-4.9 -v
Using built-in specs.
COLLECT_GCC=g++-4.9
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr/local --program-suffix=-4.9 --enable-languages=c,c++,lto
Thread model: posix
gcc version 4.9.0 20130620 (experimental) (GCC)

$ g++-4.9 -std=c++11 src/parser.cpp.1.ii
../../src/parser.cpp: In instantiation of 'pomdp::parsed_POMDP<_POMDP_traits>::parse(std::istream&) [with _POMDP_traits = pomdp::POMDP_sparse_traits; std::istream = std::basic_istream<char>]::<lambda(const matOS&, boost::spirit::unused_type, boost::spirit::unused_type)>':
../../src/parser.cpp:291:42:   required from 'struct pomdp::parsed_POMDP<_POMDP_traits>::parse(std::istream&) [with _POMDP_traits = pomdp::POMDP_sparse_traits; std::istream = std::basic_istream<char>]::<lambda(const matOS&, struct boost::spirit::unused_type, struct boost::spirit::unused_type)>'
../../src/parser.cpp:290:6:   required from 'bool pomdp::parsed_POMDP<_POMDP_traits>::parse(std::istream&) [with _POMDP_traits = pomdp::POMDP_sparse_traits; std::istream = std::basic_istream<char>]'
../../src/parser.cpp:433:16:   required from here
../../src/parser.cpp:291:103: internal compiler error: in tsubst_copy, at cp/pt.c:12213
              matOS_.operator[]([this,&a,&s1](matOS const &d, unused_type, unused_type){ forall(a){ rewar[a].makeCompressed(); forall(s1) { rewar[a].col(s1) = d.transpose() * O(a).col(s1); }}})
                                                                                                       ^
0x59f7f0 tsubst_copy
        ../../gcc/cp/pt.c:12213
0x57cee9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:14484
0x59081c tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11807
0x59c8fa tsubst_template_args
        ../../gcc/cp/pt.c:9640
0x59d2fe tsubst_aggr_type
        ../../gcc/cp/pt.c:9837
0x590a25 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11695
0x57d852 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:13601
0x57f21c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:13724
0x57e940 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:14154
0x586a12 tsubst_expr
        ../../gcc/cp/pt.c:13415
0x5890de tsubst_expr
        ../../gcc/cp/pt.c:12973
0x5864b3 tsubst_expr
        ../../gcc/cp/pt.c:12880
0x587284 tsubst_expr
        ../../gcc/cp/pt.c:13070
0x5864b3 tsubst_expr
        ../../gcc/cp/pt.c:12880
0x587284 tsubst_expr
        ../../gcc/cp/pt.c:13070
0x584e5b instantiate_decl(tree_node*, int, bool)
        ../../gcc/cp/pt.c:19112
0x5bcb67 instantiate_class_template_1
        ../../gcc/cp/pt.c:9018
0x5bcb67 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:9086
0x647dcb complete_type(tree_node*)
        ../../gcc/cp/typeck.c:131
0x57dd30 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:14581
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.
Comment 1 Takaki Makino 2013-06-20 10:43:35 UTC
It seems that the attachment file size was 1000.3KB and rejected by bugzilla. Anyway please download preprocessed source from the URL above.
Comment 2 Paolo Carlini 2013-06-20 11:41:47 UTC
Please no URLs. And please do your best to reduce the testcase to a manageable size, there are many tools you can use for that and we have a section in the wiki about it.
Comment 3 Takaki Makino 2013-06-21 18:09:45 UTC
Created attachment 30336 [details]
Reduced testcase

Hi Paolo,
Thank you for referring to the useful resource.
Using these tools I've got a reduced version (attached)
I believe this is a valid code.

$ g++-4.9 -std=c++11  testcase.cpp
testcase.cpp: In instantiation of 'X<T>::f() [with T = int]::<lambda()>':
testcase.cpp:11:11:   required from 'struct X<T>::f() [with T = int]::<lambda()>'
testcase.cpp:11:9:   required from 'bool X<T>::f() [with T = int]'
testcase.cpp:16:16:   required from here
testcase.cpp:12:62: internal compiler error: in tsubst_copy, at cp/pt.c:12213
             typename remove_reference < decltype (a) >::type t;
                                                              ^
0x59f7f0 tsubst_copy
        ../../gcc/cp/pt.c:12213
0x57cee9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:14484
0x59081c tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11807
0x59c8fa tsubst_template_args
        ../../gcc/cp/pt.c:9640
0x59d2fe tsubst_aggr_type
        ../../gcc/cp/pt.c:9837
0x590a25 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11695
0x5a1581 tsubst_decl
        ../../gcc/cp/pt.c:10652
0x5913b4 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:11101
0x586eef tsubst_expr
        ../../gcc/cp/pt.c:12931
0x587284 tsubst_expr
        ../../gcc/cp/pt.c:13070
0x5864b3 tsubst_expr
        ../../gcc/cp/pt.c:12880
0x587284 tsubst_expr
        ../../gcc/cp/pt.c:13070
0x584e5b instantiate_decl(tree_node*, int, bool)
        ../../gcc/cp/pt.c:19112
0x5bcb67 instantiate_class_template_1
        ../../gcc/cp/pt.c:9018
0x5bcb67 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:9086
0x647dcb complete_type(tree_node*)
        ../../gcc/cp/typeck.c:131
0x57dd30 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/cp/pt.c:14581
0x586a12 tsubst_expr
        ../../gcc/cp/pt.c:13415
0x586f6f tsubst_expr
        ../../gcc/cp/pt.c:12894
0x5864b3 tsubst_expr
        ../../gcc/cp/pt.c:12880
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.
Comment 4 Paolo Carlini 2013-06-21 18:20:19 UTC
Thank you! Indeed, it looks like a regression present only in mainline.
Comment 5 Paolo Carlini 2013-06-21 18:54:35 UTC
Appeared with r197811. CC-ing Jason.
Comment 6 Jason Merrill 2013-07-09 18:54:47 UTC
Fixed.