https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117398
Bug ID: 117398 Summary: ICE: in invert, at value-range.cc:2165 at -O3 with "-fno-thread-jumps" Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- ******************************************************************************* OS and Platform: $ uname -a: Linux 65dac7c84719 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* gcc version: Using built-in specs. COLLECT_GCC=/home/software/gcc-trunk-3aa004f/bin/gcc COLLECT_LTO_WRAPPER=/home/software/gcc-trunk-3aa004f/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --disable-multilib --disable-bootstrap --enable-languages=c,c++ --prefix=/home/software/gcc-trunk-3aa004f --enable-coverage Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240630 (experimental) (GCC) ******************************************************************************* Program: $ cat mutant.c int a; void c(); int d() { _Bool b; switch (b) { case 1: break; case 0: break; default: c(); } if (b) return a; } ******************************************************************************* Command Lines: $ gcc -O3 -fno-thread-jump mutant.c mutant.c: In function 'd': mutant.c:5:3: warning: switch condition has boolean value [-Wswitch-bool] 5 | switch (b) { | ^~~~~~ during GIMPLE pass: evrp mutant.c:15:1: internal compiler error: in invert, at value-range.cc:2165 15 | } | ^ 0x5071bcf diagnostic_context::report_diagnostic(diagnostic_info*) ???:0 0x50724a1 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x50924c7 internal_error(char const*, ...) ???:0 0x50729e4 fancy_abort(char const*, int, char const*) ???:0 0x26f5a11 irange::invert() ???:0 0x4b6a318 gimple_outgoing_range::calc_switch_ranges(gswitch*) ???:0 0x4b69df7 gimple_outgoing_range::switch_edge_range(irange&, gswitch*, edge_def*) ???:0 0x4b6aa11 gimple_outgoing_range::edge_range_p(irange&, edge_def*) ???:0 0x4b819f8 gori_compute::edge_range_p(vrange&, edge_def*, tree_node*, range_query&) ???:0 0x4b624d5 ranger_cache::edge_range(vrange&, edge_def*, tree_node*, ranger_cache::rfd_mode) ???:0 0x4b6572c ranger_cache::resolve_dom(vrange&, tree_node*, basic_block_def*) ???:0 0x4b66316 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*, ranger_cache::rfd_mode) ???:0 0x4b63e23 ranger_cache::fill_block_cache(tree_node*, basic_block_def*, basic_block_def*) ???:0 0x4b62a70 ranger_cache::block_range(vrange&, basic_block_def*, tree_node*, bool) ???:0 0x4b53937 gimple_ranger::range_on_entry(vrange&, basic_block_def*, tree_node*) ???:0 0x4b535e3 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*) ???:0 0x26e08cf range_query::value_of_expr(tree_node*, gimple*) ???:0 0x264999a rvrp_folder::value_of_expr(tree_node*, gimple*) ???:0 0x23533d2 substitute_and_fold_engine::replace_uses_in(gimple*) ???:0 0x2354b24 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*) ???:0 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. Godbolt link: https://godbolt.org/z/Mq4WEnqYn