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

            Bug ID: 112784
           Summary: ICE in smallest_mode_for_size, at stor-layout.cc:356 |
                    -finline-stringops
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mjires at suse dot cz
                CC: aoliva at gcc dot gnu.org
  Target Milestone: ---

Compiling reduced testcase c-c++-common/torture/builtin-clear-padding-2.c
results in ICE with new -finline-stringops.


$ cat builtin-clear-padding-2.c
struct S {
  int e;
} __attribute__((aligned(128)));

int main() {
  struct S s1;
  struct S s2;
  int v = __builtin_memcmp(&s1, &s2, sizeof(s1));
}


$ gcc builtin-clear-padding-2.c -mavx512cd -finline-stringops
during RTL pass: expand
builtin-clear-padding-2.c: In function ‘main’:
builtin-clear-padding-2.c:8:11: internal compiler error: in
smallest_mode_for_size, at stor-layout.cc:356
    8 |   int v = __builtin_memcmp(&s1, &s2, sizeof(s1));
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x10111ef smallest_mode_for_size(poly_int<1u, unsigned long>, mode_class)
        /home/mjires/git/GCC/master/gcc/stor-layout.cc:356
0xc19bc2 smallest_int_mode_for_size(poly_int<1u, unsigned long>)
        /home/mjires/git/GCC/master/gcc/machmode.h:916
0xc19bc2 emit_block_cmp_via_loop
        /home/mjires/git/GCC/master/gcc/expr.cc:2705
0xab40ab expand_builtin_memcmp
        /home/mjires/git/GCC/master/gcc/builtins.cc:4825
0xabea1f expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        /home/mjires/git/GCC/master/gcc/builtins.cc:7893
0xc0e9e4 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /home/mjires/git/GCC/master/gcc/expr.cc:12304
0xc1b4d5 store_expr(tree_node*, rtx_def*, int, bool, bool)
        /home/mjires/git/GCC/master/gcc/expr.cc:6711
0xc21870 expand_assignment(tree_node*, tree_node*, bool)
        /home/mjires/git/GCC/master/gcc/expr.cc:6432
0xc21870 expand_assignment(tree_node*, tree_node*, bool)
        /home/mjires/git/GCC/master/gcc/expr.cc:5947
0xae9026 expand_call_stmt
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:2830
0xae9026 expand_gimple_stmt_1
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:3881
0xae9026 expand_gimple_stmt
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:4045
0xaea307 expand_gimple_basic_block
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:6101
0xaebf66 execute
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:6836
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.


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/mjires/built/master/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/mjires/git/GCC/master/configure
--prefix=/home/mjires/built/master --disable-bootstrap --enable-checking
--enable-languages=c,c++,fortran,lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231130 (experimental) (GCC)

Reply via email to