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

            Bug ID: 121303
           Summary: [16 Regression] ICE: SIGSEGV in is_store_forwarding
                    (avoid-store-forwarding.cc:152) with -O1
                    -favoid-store-forwarding
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 61997
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61997&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O1 -favoid-store-forwarding testcase.c -wrapper
valgrind,-q
==14144== Invalid write of size 8
==14144==    at 0x15D2670: operator-<1, long int, long int> (poly-int.h:875)
==14144==    by 0x15D2670: (anonymous
namespace)::store_forwarding_analyzer::is_store_forwarding(rtx_def*, rtx_def*,
long*) [clone .isra.0] (avoid-store-forwarding.cc:152)
==14144==    by 0x15D420D: (anonymous
namespace)::store_forwarding_analyzer::avoid_store_forwarding(basic_block_def*)
(avoid-store-forwarding.cc:626)
==14144==    by 0x15D4C7E: (anonymous
namespace)::pass_rtl_avoid_store_forwarding::execute(function*)
(avoid-store-forwarding.cc:725)
==14144==    by 0x148688F: execute_one_pass(opt_pass*) (passes.cc:2648)
==14144==    by 0x148713F: execute_pass_list_1(opt_pass*) (passes.cc:2757)
==14144==    by 0x1487151: execute_pass_list_1(opt_pass*) (passes.cc:2758)
==14144==    by 0x1487178: execute_pass_list(function*, opt_pass*)
(passes.cc:2768)
==14144==    by 0x1024318: expand (cgraphunit.cc:1859)
==14144==    by 0x1024318: cgraph_node::expand() (cgraphunit.cc:1812)
==14144==    by 0x102615A: expand_all_functions (cgraphunit.cc:2042)
==14144==    by 0x102615A: symbol_table::compile() [clone .part.0]
(cgraphunit.cc:2419)
==14144==    by 0x102887D: compile (cgraphunit.cc:2329)
==14144==    by 0x102887D: symbol_table::finalize_compilation_unit()
(cgraphunit.cc:2608)
==14144==    by 0x15E0441: compile_file() (toplev.cc:480)
==14144==    by 0xE0E77F: do_compile (toplev.cc:2216)
==14144==    by 0xE0E77F: toplev::main(int, char**) (toplev.cc:2379)
==14144==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==14144== 
during RTL pass: avoid_store_forwarding
testcase.c: In function 'nir_lower_fb_read_instr':
testcase.c:19:1: internal compiler error: Segmentation fault
   19 | }
      | ^
0x2b79ee1 internal_error(char const*, ...)
        /repo/gcc-trunk/gcc/diagnostic-global-context.cc:534
0x15dfe0f crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:323
0x15d2670 poly_int<1u, poly_result<long, long, poly_coeff_pair_traits<long,
long>::result_kind>::type> operator-<1u, long, long>(poly_int<1u, long> const&,
poly_int<1u, long> const&)
        /repo/gcc-trunk/gcc/poly-int.h:875
0x15d2670 is_store_forwarding
        /repo/gcc-trunk/gcc/avoid-store-forwarding.cc:152
0x15d420d avoid_store_forwarding
        /repo/gcc-trunk/gcc/avoid-store-forwarding.cc:626
0x15d4c7e execute
        /repo/gcc-trunk/gcc/avoid-store-forwarding.cc:725
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.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20250729192102-r16-2618-g241380c6d632eb-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20250729192102-r16-2618-g241380c6d632eb-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250729 (experimental) (GCC)

Reply via email to