https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103207
Bug ID: 103207 Summary: [12 Regression] ICE in verify_range, at value-range.cc:385 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: ice-checking, ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- gcc-12.0.0-alpha20211107 snapshot (g:962ff7d2849e1fa6a1fe0535aa2dec5c2b9a32a6) ICEs when compiling the following testcase, reduced from test/Sema/switch-1.c from the clang 12.0.0 test suite, w/ -O2 --param case-values-threshold=1: int f(int i) { switch (i) { case 2147483647: return 1; case 9223372036854775807L: return 2; case (2147483647*4)%4: return 4; } return 0; } % gcc-12.0.0 -O2 --param case-values-threshold=1 -c cxsrkwpe.c cxsrkwpe.c: In function 'f': cxsrkwpe.c:5:5: warning: overflow in conversion from 'long int' to 'int' changes value from '9223372036854775807' to '-1' [-Woverflow] 5 | case 9223372036854775807L: | ^~~~ cxsrkwpe.c:7:21: warning: integer overflow in expression of type 'int' results in '-4' [-Woverflow] 7 | case (2147483647*4)%4: | ^ during GIMPLE pass: thread cxsrkwpe.c:1:5: internal compiler error: in verify_range, at value-range.cc:385 1 | int f(int i) { | ^ 0x78ae3b irange::verify_range() /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/value-range.cc:385 0x115a64e int_range<255u>::int_range(tree_node*, tree_node*, value_range_kind) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/value-range.h:425 0x115a64e find_case_label_range(gswitch*, irange const*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-vrp.c:2496 0x10ca508 back_threader::find_taken_edge_switch(vec<basic_block_def*, va_heap, vl_ptr> const&, gswitch*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:263 0x10cb11f back_threader::maybe_register_path() /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:198 0x10cb855 back_threader::find_paths_to_names(basic_block_def*, bitmap_head*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:404 0x10cb8d9 back_threader::find_paths_to_names(basic_block_def*, bitmap_head*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:442 0x10cbe11 back_threader::find_paths(basic_block_def*, tree_node*) /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:477 0x10cc041 back_threader::thread_blocks() /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:922 0x10cc0b4 execute /var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211107/work/gcc-12-20211107/gcc/tree-ssa-threadbackward.c:1024