[Bug c++/72759] New: ICE on invalid C++ code on x86_64-linux-gnu (Segmentation fault, tree_class_check, ocp_convert)
chengniansun at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jul 30 12:10:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72759
Bug ID: 72759
Summary: ICE on invalid C++ code on x86_64-linux-gnu
(Segmentation fault, tree_class_check, ocp_convert)
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
Target Milestone: ---
$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160730 (experimental) [trunk revision 238903] (GCC)
$ g++-trunk small.C -std=c++14
small.C: In static member function ‘static void Specializer::A<<anonymous>
>::InnerMemberFn()’:
small.C:14:39: error: ‘SpecMbrFnPtr’ was not declared in this scope
Spec ErrorSite = Spec::SpecMbrFnPtr<SpecMbrFnPtr>;
^~~~~~~~~~~~
small.C: In instantiation of ‘static void Specializer::A<<anonymous>
>::InnerMemberFn() [with unsigned int <anonymous> = 0u]’:
small.C:5:26: required from here
small.C:14:8: internal compiler error: Segmentation fault
Spec ErrorSite = Spec::SpecMbrFnPtr<SpecMbrFnPtr>;
^~~~~~~~~
0xdb298f crash_signal
../../gcc-source-trunk/gcc/toplev.c:335
0x7f5a9d tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-source-trunk/gcc/tree.h:3145
0x7f5a9d ocp_convert(tree_node*, tree_node*, int, int, int)
../../gcc-source-trunk/gcc/cp/cvt.c:859
0x8049aa expand_default_init
../../gcc-source-trunk/gcc/cp/init.c:1685
0x8049aa expand_aggr_init_1
../../gcc-source-trunk/gcc/cp/init.c:1863
0x8051e4 build_aggr_init(tree_node*, tree_node*, int, int)
../../gcc-source-trunk/gcc/cp/init.c:1602
0x69ba94 build_aggr_init_full_exprs
../../gcc-source-trunk/gcc/cp/decl.c:6004
0x69ba94 check_initializer
../../gcc-source-trunk/gcc/cp/decl.c:6151
0x6bbb2e cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc-source-trunk/gcc/cp/decl.c:6856
0x6f0171 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15327
0x6ec644 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15216
0x6ecb22 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc-source-trunk/gcc/cp/pt.c:15401
0x6ea420 instantiate_decl(tree_node*, int, bool)
../../gcc-source-trunk/gcc/cp/pt.c:22133
0x732729 instantiate_pending_templates(int)
../../gcc-source-trunk/gcc/cp/pt.c:22252
0x778111 c_parse_final_cleanups()
../../gcc-source-trunk/gcc/cp/decl2.c:4601
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.
$
$ cat small.C
template <typename> struct SpecPerType;
class Specializer {
public: template <bool> static void MbrFnTempl();
template <unsigned> struct A { static void InnerMemberFn(); };
void Trigger() { A<0>::InnerMemberFn; }
};
template <> struct SpecPerType<Specializer> {
using FnType = void *;
template <bool P>
static constexpr FnType SpecMbrFnPtr = Specializer::MbrFnTempl<P>;
};
template <unsigned X> void Specializer::A<X>::InnerMemberFn() {
using Spec = SpecPerType<Specializer>;
Spec ErrorSite = Spec::SpecMbrFnPtr<SpecMbrFnPtr>;
}
$
More information about the Gcc-bugs
mailing list