https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103910
Bug ID: 103910 Summary: openjdk17 causes ICE on -O3 -march=opteron -fchecking-new: during GIMPLE pass: aprefetch: in gimple_build_call, at gimple.c:267 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Target: x86_64-pc-linux-gnu ICE initially noticed by Alexander Weber in https://bugs.gentoo.org/822690. Here is the reduced test, fails on both gcc-12 and gcc-11.2.0. Note: it needs a gch header. //$ cat archiveBuilder.cpp #include "precompiled.hpp" void *operator new(unsigned long, void *__p) { return __p; } #define MEMORY_TYPES_DO(f) f(mtNone, ) enum MEMFLAGS {}; #define MEMORY_TYPE_SHORTNAME(type, human_readable) MEMFLAGS type; MEMORY_TYPES_DO(MEMORY_TYPE_SHORTNAME) struct GrowableArrayView { GrowableArrayView(int *, int, int); }; int *GrowableArrayWithAllocator_data; struct GrowableArrayWithAllocator : GrowableArrayView { GrowableArrayWithAllocator(int initial_max) : GrowableArrayView(GrowableArrayWithAllocator_data, initial_max, 0) { for (int i = 0; i < initial_max; i++) new (&GrowableArrayWithAllocator_data[i]) int(); } }; struct GrowableArrayMetadata { GrowableArrayMetadata(MEMFLAGS); }; struct GrowableArray : GrowableArrayWithAllocator { GrowableArrayMetadata _metadata; GrowableArray(int initial_max) : GrowableArrayWithAllocator(initial_max), _metadata(mtNone) {} }; struct SourceObjList { SourceObjList(); }; SourceObjList::SourceObjList() { GrowableArray(128 * 1024); } $ rm -rf ph $ mkdir -p ph $ touch precompiled_.hpp # create empty file $ ./xg++ -B. -O3 -march=opteron -fcheck-new -c precompiled_.hpp -o ph/precompiled.hpp.gch $ ./xg++ -B. -O3 -march=opteron -fcheck-new -Iph -c archiveBuilder.cpp -o a.o during GIMPLE pass: aprefetch archiveBuilder.cpp: In constructor ‘SourceObjList::SourceObjList()’: archiveBuilder.cpp:28:1: internal compiler error: in gimple_build_call, at gimple.c:267 28 | SourceObjList::SourceObjList() { GrowableArray(128 * 1024); } | ^~~~~~~~~~~~~ 0xd2845f gimple_build_call(tree_node*, unsigned int, ...) gcc/gimple.c:267 0x12880c8 emit_mfence_after_loop gcc/tree-ssa-loop-prefetch.c:1300 0x12880c8 mark_nontemporal_stores gcc/tree-ssa-loop-prefetch.c:1359 0x12880c8 loop_prefetch_arrays gcc/tree-ssa-loop-prefetch.c:1955 0x12880c8 tree_ssa_prefetch_arrays() gcc/tree-ssa-loop-prefetch.c:2031 0x1288be9 execute gcc/tree-ssa-loop-prefetch.c:2097 $ ./xg++ -v Using built-in specs. COLLECT_GCC=./xg++ Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --disable-bootstrap --with-native-system-header-dir=<<NIX>>-glibc-2.33-59-dev/include --prefix=/home/slyfox/dev/git/gcc-build/__td__ CFLAGS='-O1 -ggdb3' CXXFLAGS='-O1 -ggdb3' LDFLAGS='-O1 -ggdb3' Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20220104 (experimental) (GCC)