https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126905

            Bug ID: 126905
           Summary: [17 Regression] ICE in type, at value-range.h:1088
                    during GIMPLE pass: threadfull with assume
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bouncy12578 at gmail dot com
  Target Milestone: ---

Created attachment 65347
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65347&action=edit
preprocessed file

Compiler Explorer: https://godbolt.org/z/Mxs1YqevK

Known to fail: trunk
Known to work: 16.2

Compiler version: 
Using built-in specs.
COLLECT_GCC=/data/lenovo/compiler-build/gcc/gcc-install/bin/gcc
COLLECT_LTO_WRAPPER=/data/lenovo/compiler-build/gcc/gcc-install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure
--prefix=/data/lenovo/compiler-build/gcc/gcc-install --disable-bootstrap
--enable-languages=c,c++ --disable-multilib --with-isl --enable-checking=all :
(reconfigured) ../gcc/configure
--prefix=/data/lenovo/compiler-build/gcc/gcc-install --disable-bootstrap
--enable-languages=c,c++ --disable-multilib --with-isl --enable-checking=all
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260814 (experimental) (GCC)

Command line used:
g++ -O2 -g -masm=intel -mtune=generic -march=x86-64 test.cpp

Code to reproduce:

long a;
#define ASSUME(x)  [[assume(x)]];
#include <algorithm>
void b(bool c, bool d) {
  ASSUME(c + 3 == 3);
  for (int i = 0; i < 3; i++)
    a = std::max(d * c, (int)c) ? 4085320707 ? d : d : 0;
}


Note: This test case was automatically generated by a fuzzer and reduced.


Compiler output:

during GIMPLE pass: threadfull
crash.c: In function ‘void b(bool, bool)’:
crash.c:4:6: internal compiler error: in type, at value-range.h:1088
    4 | void b(bool c, bool d) {
      |      ^
0x32b911b internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:787
0xfacab3 fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostics/context.cc:1813
0x9e1e5e irange::type() const
        ../../gcc/gcc/value-range.h:1088
0x9e2820 irange::type() const
        ../../gcc/gcc/tree.h:3840
0x9e2820 operator_logical_and::op1_range(irange&, tree_node*, irange const&,
irange const&, relation_trio) const
        ../../gcc/gcc/range-op.cc:3442
0x165fc1f gori_compute::refine_using_relation(tree_node*, vrange&, tree_node*,
vrange&, fur_source&, relation_kind_t)
        ../../gcc/gcc/gimple-range-gori.cc:1089
0x1660c9b gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, fur_source&, value_relation*)
        ../../gcc/gcc/gimple-range-gori.cc:1255
0x166263a gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        ../../gcc/gcc/gimple-range-gori.cc:679
0x1664761 gori_compute::edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
        ../../gcc/gcc/gimple-range-gori.cc:1443
0x1658ac2 fur_source::register_outgoing_edges(gcond*, irange&, edge_def*,
edge_def*)
        ../../gcc/gcc/gimple-range-fold.cc:1742
0x1c4ab74 path_range_query::compute_outgoing_relations(basic_block_def*,
basic_block_def*)
        ../../gcc/gcc/gimple-range-path.cc:771
0x1c4cffa path_range_query::compute_ranges(bitmap_head const*)
        ../../gcc/gcc/gimple-range-path.cc:592
0x1ce1015 back_threader::find_taken_edge_cond(vec<basic_block_def*, va_heap,
vl_ptr> const&, gcond*)
        ../../gcc/gcc/tree-ssa-threadbackward.cc:355
0x1ce1ac2 back_threader::maybe_register_path(back_threader_profitability&)
        ../../gcc/gcc/tree-ssa-threadbackward.cc:246
0x1ce1e9e back_threader::find_paths_to_names(basic_block_def*, bitmap_head*,
unsigned int, back_threader_profitability&)
        ../../gcc/gcc/tree-ssa-threadbackward.cc:402
0x1ce240a back_threader::find_paths_to_names(basic_block_def*, bitmap_head*,
unsigned int, back_threader_profitability&)
        ../../gcc/gcc/tree-ssa-threadbackward.cc:506
0x1ce240a back_threader::find_paths_to_names(basic_block_def*, bitmap_head*,
unsigned int, back_threader_profitability&)
        ../../gcc/gcc/tree-ssa-threadbackward.cc:506
0x1ce2c8c back_threader::maybe_thread_block(basic_block_def*)
        ../../gcc/gcc/tree-ssa-threadbackward.cc:575
0x1ce2d41 back_threader::thread_blocks()
        ../../gcc/gcc/tree-ssa-threadbackward.cc:958
0x1ce2e27 execute
        ../../gcc/gcc/tree-ssa-threadbackward.cc:1088
/data/lenovo/compiler-build/gcc/gcc-install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1plus
-quiet -imultiarch x86_64-linux-gnu -D_GNU_SOURCE crash.c -quiet -dumpdir a-
-dumpbase crash.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O2 -o
/tmp/ccG6lv7t.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.

Reply via email to