https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870
Bug ID: 95870 Summary: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: viktor.rosendahl at bmw dot de Target Milestone: --- Created attachment 48780 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48780&action=edit Selfcontained example (preprocessed cource code) I can reproduce this bug with the following gcc versions: 9.3.0 10.1.0 11.0.0 20200624 (experimental) [this was built with revision eb0ff770e29 from git://gcc.gnu.org/git/gcc.git, which was the tip of the master branch on 24th of June, 2020] The bug does not happen with: 7.5.0 I have not tested any 8.x version. All compilers were built from pristine sources, no patches added. My system is a x86_64 machine with Ubuntu 18.04.4 LTS. I configured all compiler builds like this: ./configure --disable-multilib --prefix=/home/viktor/gcc-bin-9.3.0 --enable-languages=c,c++ Steps to reproduce: xz -dc preproc_example4.ii.xz > preproc_example4.ii g++ -c -pipe -O2 -Wall -std=c++17 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -o obj/example4.o preproc_example4.ii I get the following output (with gcc-9.3.0): example4.cpp: In instantiation of ‘BungleFooBar<U, V>::BungleFooBar() [with U = FailFoo; V = BotchFoo]’: example4.cpp:44:22: required from here example4.cpp:17:5: internal compiler error: Segmentation fault 17 | MACRO_FOOBAR(foofoobar, bar); | ^ 0xb8ff1f crash_signal ../.././gcc/toplev.c:326 0x6e4260 most_general_template(tree_node*) ../.././gcc/cp/pt.c:23652 0x6e457d enclosing_instantiation_of ../.././gcc/cp/pt.c:13424 0x701c53 tsubst_function_decl ../.././gcc/cp/pt.c:12943 0x6fe2b8 tsubst_decl ../.././gcc/cp/pt.c:13464 0x6f9ee7 tsubst(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:14365 0x70263a lookup_template_class_1 ../.././gcc/cp/pt.c:9483 0x70263a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ../.././gcc/cp/pt.c:9771 0x700e5d tsubst_aggr_type ../.././gcc/cp/pt.c:12764 0x6f9cbf tsubst(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:14447 0x6fe940 tsubst_decl ../.././gcc/cp/pt.c:13731 0x6f9ee7 tsubst(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:14365 0x6f42ce tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../.././gcc/cp/pt.c:17173 0x6f2378 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../.././gcc/cp/pt.c:17088 0x6f24ec tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../.././gcc/cp/pt.c:17389 0x6f24ec tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../.././gcc/cp/pt.c:17389 0x6f5885 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../.././gcc/cp/pt.c:17073 0x6f5885 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ../.././gcc/cp/pt.c:18301 0x6f7775 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../.././gcc/cp/pt.c:19666 0x6f618e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) ../.././gcc/cp/pt.c:18918 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.