https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127054
Bug ID: 127054
Summary: [17 Regression] ICE on llvm-21.1.8 during GIMPLE pass:
vrp: Segmentation fault
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Initially noticed gcc-master ICE on llvm-21.1.8 on r17-3627-g33053605189f2b,
did not bisect.
Extracted example:
// $ cat bug.cc.cc
typedef long uint64_t;
enum { Terminator };
class MCInstrDesc {
public:
uint64_t Flags;
uint64_t getFlags() { return Flags; }
};
class MachineInstr {
MCInstrDesc *MCID;
public:
MCInstrDesc getDesc() { return *MCID; }
enum QueryType { AnyInBundle };
bool hasProperty(unsigned, QueryType) { return getDesc().getFlags(); }
bool isTerminator(QueryType Type = AnyInBundle) {
return hasProperty(Terminator, Type);
}
};
class RegBankSelect {
class InsertPoint { virtual bool isSplit() const; };
class InstrInsertPoint : InsertPoint {
MachineInstr & Instr;
void materialize();
bool isSplit() const;
};
};
void RegBankSelect::InstrInsertPoint::materialize() {
if (isSplit())
__builtin_unreachable();
}
bool RegBankSelect::InstrInsertPoint::isSplit() const {
return Instr.isTerminator();
}
$ gcc/xg++ -Bgcc -c -O3 -std=c++17 -c bug.cc.cc
during GIMPLE pass: vrp
bug.cc.cc: In member function 'void
RegBankSelect::InstrInsertPoint::materialize()':
bug.cc.cc:26:6: internal compiler error: Segmentation fault
26 | void RegBankSelect::InstrInsertPoint::materialize() {
| ^~~~~~~~~~~~~
0x2c7b380 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2c6d574 internal_error(char const*, ...)
???:0
0x14436b5 crash_signal(int)
???:0
0x101ed1c infer_range_manager::clear(tree_node*)
???:0
0x188eb98 range_query::reset_range_info(tree_node*)
???:0
0x1003cda ranger_cache::reset_range_info(tree_node*)
???:0
0x10005da gimple_ranger::reset_range_info(tree_node*)
???:0
0x17596ae reset_flow_sensitive_info(tree_node*)
???:0
0x15d555c simple_dce_from_worklist(bitmap_head*, bitmap_head*, bool)
???:0
0x183f756 remove_unreachable::handle_early(gimple*, edge_def*)
???:0
0x183f92a remove_unreachable::maybe_register(gimple*)
???:0
0x18460b0 rvrp_folder::pre_fold_stmt(gimple*)
???:0
0x16b549e substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
???:0
0x2946fe6 dom_walker::walk(basic_block_def*)
???:0
0x16b3fb4 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
???:0
0x1843083 execute_ranger_vrp(function*, bool)
???:0
0x1845443 (anonymous namespace)::pass_vrp::execute(function*)
???:0
gcc/cc1plus -quiet -iprefix /tmp/gb/gcc/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
-isystem gcc/include -isystem gcc/include-fixed -D_GNU_SOURCE bug.cc.cc -quiet
-dumpbase bug.cc.cc -dumpbase-ext .cc -mtune=generic -march=x86-64 -O3
-std=c++17 -o /tmp/nix-shell-540104-2923004304/ccjOZeKX.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ gcc/xg++ -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xg++
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer
--enable-languages=c,c++ CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0' LDFLAGS='-O1 -g0'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260825 (experimental) (GCC)