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

            Bug ID: 121934
           Summary: ICE on valid code at -O3 "-fno-tree-dominator-opts
                    -fno-tree-vrp -fno-tree-ccp -fno-tree-forwprop
                    -fno-tree-pre -fno-tree-fre" on x86_64-linux-gnu: in
                    expand_set_or_cpymem_prologue_epilogue_by_misaligned_m
                    oves, at config/i386/i386-expand.cc:8873
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

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

Note:
- works: 15.2 and earlier
- fails: trunk

[584] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250912 (experimental) (GCC)
[585] %
[585] % gcctk -O3 -c small.c
[586] %
[586] % gcctk -O3 -c -fno-tree-dominator-opts -fno-tree-vrp -fno-tree-ccp
-fno-tree-forwprop -fno-tree-pre -fno-tree-fre small.c
during RTL pass: expand
small.c: In function ā€˜g’:
small.c:14:12: internal compiler error: in
expand_set_or_cpymem_prologue_epilogue_by_misaligned_moves, at
config/i386/i386-expand.cc:8873
   14 |       d[h] = -1U;
      |       ~~~~~^~~~~
0x255ef5b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:786
0xa08380 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1786
0x943a8d expand_set_or_cpymem_prologue_epilogue_by_misaligned_moves
        ../../gcc-trunk/gcc/config/i386/i386-expand.cc:8873
0x943a8d ix86_expand_set_or_cpymem(rtx_def*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, bool)
        ../../gcc-trunk/gcc/config/i386/i386-expand.cc:9691
0x1f1e166 gen_setmemsi(rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        ../../gcc-trunk/gcc/config/i386/i386.md:25988
0x102f1cd rtx_insn* insn_gen_fn::operator()<rtx_def*, rtx_def*, rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*>(rtx_def*,
rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*,
rtx_def*) const
        ../../gcc-trunk/gcc/recog.h:472
0x102f1cd maybe_gen_insn(insn_code, unsigned int, expand_operand*)
        ../../gcc-trunk/gcc/optabs.cc:8237
0x1033e1c maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        ../../gcc-trunk/gcc/optabs.cc:8257
0xd11894 set_storage_via_setmem(rtx_def*, rtx_def*, rtx_def*, unsigned int,
unsigned int, long, unsigned long, unsigned long, unsigned long)
        ../../gcc-trunk/gcc/expr.cc:4047
0xbb5204 expand_builtin_memset_args
        ../../gcc-trunk/gcc/builtins.cc:4759
0xbbedd3 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        ../../gcc-trunk/gcc/builtins.cc:8275
0xd215da expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-trunk/gcc/expr.cc:12621
0xbe69c8 expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
        ../../gcc-trunk/gcc/expr.h:323
0xbe69c8 expand_call_stmt
        ../../gcc-trunk/gcc/cfgexpand.cc:3204
0xbe69c8 expand_gimple_stmt_1
        ../../gcc-trunk/gcc/cfgexpand.cc:4235
0xbe69c8 expand_gimple_stmt
        ../../gcc-trunk/gcc/cfgexpand.cc:4382
0xbebce7 expand_gimple_basic_block
        ../../gcc-trunk/gcc/cfgexpand.cc:6501
0xbee12f execute
        ../../gcc-trunk/gcc/cfgexpand.cc:7248
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.
[587] %
[587] % cat small.c
extern int f();
int printf(const char *, ...);
int a, b, c, d[3];
void g() {
  int h;
  if (f()) {
    if (b)
    i:
      c > 0;
    a = 0;
    for (h = 0; h < 3; h++) {
      if (a != 1)
        printf("0\n");
      d[h] = -1U;
    }
    goto i;
  }
}

Reply via email to