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

            Bug ID: 125854
           Summary: [17 regression] ICE when building llvm-22.1.8
                    (fill_block_cache, at gimple-range-cache.cc:1608)
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: amacleod at redhat dot com
  Target Milestone: ---

```
# g++ -c
./lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/Reassociate.cpp.ii -O2
-std=gnu++17
during RTL pass: expand
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/iterator:64,
                 from
/var/tmp/portage/llvm-core/llvm-22.1.8/work/llvm/include/llvm/ADT/ADL.h:13,
                 from
/var/tmp/portage/llvm-core/llvm-22.1.8/work/llvm/include/llvm/ADT/DenseMap.h:17,
                 from
/var/tmp/portage/llvm-core/llvm-22.1.8/work/llvm/include/llvm/Transforms/Scalar/Reassociate.h:25,
                 from
/var/tmp/portage/llvm-core/llvm-22.1.8/work/llvm/lib/Transforms/Scalar/Reassociate.cpp:22:
In function ‘constexpr typename
std::iterator_traits<_Iterator>::difference_type
std::__distance(_RandomAccessIterator, _RandomAccessIterator,
random_access_iterator_tag) [with _RandomAccessIterator =
llvm::reassociate::ValueEntry*]’,
    inlined from ‘constexpr typename
std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator,
_InputIterator) [with _InputIterator = llvm::reassociate::ValueEntry*]’ at
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/bits/stl_iterator_base_funcs.h:198:29,
    inlined from ‘_OutIter std::__copy_move_a2(_InIter, _Sent, _OutIter) [with
bool _IsMove = true; _InIter = llvm::reassociate::ValueEntry*; _Sent =
llvm::reassociate::ValueEntry*; _OutIter = llvm::reassociate::ValueEntry*]’ at
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/bits/stl_algobase.h:421:33,
    inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove =
true; _II = llvm::reassociate::ValueEntry*; _OI =
llvm::reassociate::ValueEntry*]’ at
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/bits/stl_algobase.h:490:42,
    inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove =
true; _II = llvm::reassociate::ValueEntry*; _OI =
llvm::reassociate::ValueEntry*]’ at
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/bits/stl_algobase.h:498:31,
    inlined from ‘_OI std::move(_II, _II, _OI) [with _II =
llvm::reassociate::ValueEntry*; _OI = llvm::reassociate::ValueEntry*]’ at
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/bits/stl_algobase.h:672:38,
    inlined from ‘llvm::SmallVectorImpl<T>::iterator
llvm::SmallVectorImpl<T>::erase(const_iterator) [with T =
llvm::reassociate::ValueEntry]’ at
/var/tmp/portage/llvm-core/llvm-22.1.8/work/llvm/include/llvm/ADT/SmallVector.h:754:14,
    inlined from ‘llvm::Value*
llvm::ReassociatePass::OptimizeAdd(llvm::Instruction*,
llvm::SmallVectorImpl<llvm::reassociate::ValueEntry>&)’ at
/var/tmp/portage/llvm-core/llvm-22.1.8/work/llvm/lib/Transforms/Scalar/Reassociate.cpp:1506:18:
/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17/bits/stl_iterator_base_funcs.h:108:21:
internal compiler error: in fill_block_cache, at gimple-range-cache.cc:1608
  108 |       return __last - __first;
      |              ~~~~~~~^~~~~~~~~
0x564f5805953c internal_error(char const*, ...)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/diagnostic-global-context.cc:787
0x564f580596df fancy_abort(char const*, int, char const*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/diagnostics/context.cc:1813
0x564f5693382e ranger_cache::fill_block_cache(tree_node*, basic_block_def*,
basic_block_def*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range-cache.cc:1608
0x564f587fcf2b ranger_cache::block_range(vrange&, basic_block_def*, tree_node*,
bool)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range-cache.cc:1347
0x564f587fcf2b ranger_cache::block_range(vrange&, basic_block_def*, tree_node*,
bool)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range-cache.cc:1315
0x564f587fcf2b gimple_ranger::range_on_entry(vrange&, basic_block_def*,
tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range.cc:174
0x564f58791e01 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range.cc:146
0x564f587fafb9 fur_stmt::get_operand(vrange&, tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range-fold.cc:145
0x564f587fafb9 fold_using_range::range_of_range_op(vrange&,
gimple_range_op_handler&, fur_source&)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range-fold.cc:804
0x564f587f8e00 fold_using_range::fold_stmt(vrange&, gimple*, fur_source&,
tree_node*) [clone .constprop.3]
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range-fold.cc:698
0x564f587efc7d gimple_ranger::fold_range_internal(vrange&, gimple*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range.cc:282
0x564f587efc7d gimple_ranger::prefill_stmt_dependencies(tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range.cc:423
0x564f587e0b1a gimple_ranger::range_of_stmt(vrange&, gimple*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range.cc:339
0x564f58792153 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-range.cc:142
0x564f587f57dc gimple_match_range_of_expr
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-match-head.cc:532
0x564f585a77a2 gimple_simplify_PLUS_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/build/gcc/gimple-match-3.cc:18106
0x564f583ebe43 gimple_resimplify2
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-match-exports.cc:1029
0x564f58cfeae2 gimple_simplify_78(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node*, tree_node**, tree_code)
        /usr/src/debug/sys-devel/gcc-17.0.9999/build/gcc/gimple-match-8.cc:2920
0x564f585ac091 gimple_simplify_PLUS_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.9999/build/gcc/gimple-match-3.cc:18518
0x564f583ebe43 gimple_resimplify2
       
/usr/src/debug/sys-devel/gcc-17.0.9999/gcc-17.0.9999/gcc/gimple-match-exports.cc:1029
/usr/libexec/gcc/x86_64-pc-linux-gnu/17/cc1plus -fpreprocessed
./lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/Reassociate.cpp.ii -quiet
-dumpbase Reassociate.cpp.ii -dumpbase-ext .ii -mtune=generic -march=x86-64
-mtls-dialect=gnu2 -O2 -std=gnu++17 -foffload-options=-fno-stack-protector
-fcf-protection -foffload-options=-fcf-protection=none -o /tmp/ccOSaz8c.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://bugs.gentoo.org/> for instructions.
```

```
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/17/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-17.0.9999/work/gcc-17.0.9999/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/17
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/17/python
--enable-libphobos --enable-objc-gc
--enable-languages=c,c++,d,objc,obj-c++,fortran,ada,rust --enable-obsolete
--enable-secureplt --disable-werror --with-system-zlib --enable-nls
--without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra,rtl --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 17.0.9999 p, commit
8cd95414f0988009e664760bda1f7d9feb6bf01a' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch
--enable-linker-build-id --enable-libada --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --with-tls=gnu2 --enable-multilib
--with-multilib-list=m32,mx32,m64 --disable-fixed-point --with-abi=m64
--enable-targets=all --enable-offload-defaulted
--enable-offload-targets=nvptx-none --enable-libgomp --disable-libssp
--enable-cet --disable-systemtap --enable-valgrind-annotations
--enable-valgrind-interop --disable-vtable-verify --disable-libvtv --with-zstd
--without-isl --enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1
--with-build-config='bootstrap-O3 bootstrap-lto bootstrap-cet'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260617 (experimental)
ca582ee36820a318fbc506928503282a5e35603a (Gentoo 17.0.9999 p, commit
8cd95414f0988009e664760bda1f7d9feb6bf01a)
```

Reply via email to