[Bug c++/83916] New: Internal compiler error on valid template code
blake at tradebot dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 17 15:54:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83916
Bug ID: 83916
Summary: Internal compiler error on valid template code
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: blake at tradebot dot com
Target Milestone: ---
Created attachment 43161
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43161&action=edit
Preprocessor output
Example of problem on godbolt: https://godbolt.org/g/dkyYr9
$ g++-7.2.0 -v
Using built-in specs.
COLLECT_GCC=g++-7.2.0
COLLECT_LTO_WRAPPER=/opt/toolchain/gcc-7.2.0/libexec/gcc/x86_64-redhat-linux/7.2.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../gcc-7.2.0/configure --disable-multilib --disable-bootstrap
--with-bugurl=http://bugzilla.redhat.com/Bugzilla --with-system-zlib
--build=x86_64-redhat-linux --with-default-libstdcxx-abi=gcc4-compatible
--enable-shared --enable-threads=posix --enable-checking=release
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --disable-libgcj --enable-gnu-indirect-function
--program-suffix=-7.2.0 --enable-languages=c,c++
--prefix=/opt/toolchain/gcc-7.2.0
Thread model: posix
gcc version 7.2.0 (GCC)
$ g++-7.2.0 -save-temps -std=c++17 -DTRIGGER_ERROR -o cause_bug cause_bug.cpp
cause_bug.cpp:13:42: internal compiler error: Segmentation fault
struct C : A<Type, TemplatedType, Vals...> {
^
0xad918f crash_signal
../../gcc-7.2.0/gcc/toplev.c:337
0x5da860 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc-7.2.0/gcc/cp/pt.c:13561
0x5e89a8 convert_template_argument
../../gcc-7.2.0/gcc/cp/pt.c:7721
0x5e9caa coerce_template_parameter_pack
../../gcc-7.2.0/gcc/cp/pt.c:7897
0x5e9caa coerce_template_parms
../../gcc-7.2.0/gcc/cp/pt.c:8119
0x5d981a coerce_template_template_parms
../../gcc-7.2.0/gcc/cp/pt.c:7237
0x5e88a9 convert_template_argument
../../gcc-7.2.0/gcc/cp/pt.c:7648
0x5e9d6c coerce_template_parms
../../gcc-7.2.0/gcc/cp/pt.c:8210
0x5ec849 lookup_template_class_1
../../gcc-7.2.0/gcc/cp/pt.c:8746
0x5ec849 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc-7.2.0/gcc/cp/pt.c:9091
0x686e2d finish_template_type(tree_node*, tree_node*, int)
../../gcc-7.2.0/gcc/cp/semantics.c:3164
0x6363a4 cp_parser_template_id
../../gcc-7.2.0/gcc/cp/parser.c:15514
0x6364ff cp_parser_class_name
../../gcc-7.2.0/gcc/cp/parser.c:21976
0x640b8e cp_parser_qualifying_entity
../../gcc-7.2.0/gcc/cp/parser.c:6291
0x640b8e cp_parser_nested_name_specifier_opt
../../gcc-7.2.0/gcc/cp/parser.c:5977
0x62bfd3 cp_parser_base_specifier
../../gcc-7.2.0/gcc/cp/parser.c:23769
0x62bfd3 cp_parser_base_clause
../../gcc-7.2.0/gcc/cp/parser.c:23622
0x62bfd3 cp_parser_class_head
../../gcc-7.2.0/gcc/cp/parser.c:22829
0x62bfd3 cp_parser_class_specifier_1
../../gcc-7.2.0/gcc/cp/parser.c:22060
0x62c911 cp_parser_class_specifier
../../gcc-7.2.0/gcc/cp/parser.c:22373
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://bugzilla.redhat.com/Bugzilla> for instructions.
Problem code is in the ifdef:
template<class Type, template<Type...> class TemplatedType, Type... Vals>
struct A {
};
template<class Type, template<Type...> class TemplatedType, Type... Vals>
struct B : A<Type, TemplatedType, Vals...> {
};
#ifdef TRIGGER_ERROR
template<class AnotherType, class Type, template<Type...> class TemplatedType,
Type... Vals>
struct C : A<Type, TemplatedType, Vals...> {
};
#endif
template<class Type, class AnotherType, template<Type...> class TemplatedType,
Type... Vals>
struct D : A<Type, TemplatedType, Vals...> {
};
int main() {
return 0;
}
More information about the Gcc-bugs
mailing list