Bug 113416 - ICE: in force_constant_size, at gimplify.cc:742 (in convert_move, at expr.cc:223) with -march=rv64gcv (-march=rv32gcv) and -ftree-parallelize-loops=2
Summary: ICE: in force_constant_size, at gimplify.cc:742 (in convert_move, at expr.cc:...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2024-01-16 07:17 UTC by Zdenek Sojka
Modified: 2024-02-24 02:21 UTC (History)
0 users

See Also:
Host:
Target: riscv64-unknown-linux-gnu aarch64-linux-gnu
Build:
Known to work:
Known to fail: 13.2.1, 14.0
Last reconfirmed: 2024-01-17 00:00:00


Attachments
reduced testcase (123 bytes, text/plain)
2024-01-16 07:17 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2024-01-16 07:17:10 UTC
Created attachment 57098 [details]
reduced testcase

This has been reduced from gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c ; it fails the same way with -ftree-parallelize-loops=2.

Compiler output:
$ riscv64-unknown-linux-gnu-gcc -O -march=rv64gcv -ftree-parallelize-loops=2 testcase.c 
during GIMPLE pass: parloops
testcase.c: In function 'f':
testcase.c:4:1: internal compiler error: in force_constant_size, at gimplify.cc:743
    4 | f(long out, int n)
      | ^
0xa18136 force_constant_size
        /repo/gcc-trunk/gcc/gimplify.cc:743
0x134e297 gimple_add_tmp_var(tree_node*)
        /repo/gcc-trunk/gcc/gimplify.cc:781
0x1304676 create_tmp_var(tree_node*, char const*)
        /repo/gcc-trunk/gcc/gimple-expr.cc:491
0x1780c4d separate_decls_in_region
        /repo/gcc-trunk/gcc/tree-parloops.cc:2125
0x1782dd1 gen_parallel_loop
        /repo/gcc-trunk/gcc/tree-parloops.cc:3162
0x1784a48 parallelize_loops
        /repo/gcc-trunk/gcc/tree-parloops.cc:4140
0x1785dc1 execute
        /repo/gcc-trunk/gcc/tree-parloops.cc:4228
0x1785dc1 execute
        /repo/gcc-trunk/gcc/tree-parloops.cc:4207
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.


$ riscv64-unknown-linux-gnu-gcc -O -march=rv32gcv -mabi=ilp32 -ftree-parallelize-loops=2 testcase.c 
during RTL pass: expand
testcase.c: In function 'f._loopfn.0':
testcase.c:6:17: internal compiler error: in convert_move, at expr.cc:223
    6 |   for (int i; i < n; i++) {
      |                 ^
0x9f3dd1 convert_move(rtx_def*, rtx_def*, int)
        /repo/gcc-trunk/gcc/expr.cc:223
0x127807a store_expr(tree_node*, rtx_def*, int, bool, bool)
        /repo/gcc-trunk/gcc/expr.cc:6810
0x1279909 expand_assignment(tree_node*, tree_node*, bool)
        /repo/gcc-trunk/gcc/expr.cc:6443
0x112715c expand_gimple_stmt_1
        /repo/gcc-trunk/gcc/cfgexpand.cc:3966
0x112715c expand_gimple_stmt
        /repo/gcc-trunk/gcc/cfgexpand.cc:4064
0x112e2be expand_gimple_basic_block
        /repo/gcc-trunk/gcc/cfgexpand.cc:6120
0x112fec7 execute
        /repo/gcc-trunk/gcc/cfgexpand.cc:6855
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.


$ riscv64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-riscv64/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-7258-20240115151353-g731444b3c39-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/14.0.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --with-isa-spec=2.2 --with-sysroot=/usr/riscv64-unknown-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=riscv64-unknown-linux-gnu --with-ld=/usr/bin/riscv64-unknown-linux-gnu-ld --with-as=/usr/bin/riscv64-unknown-linux-gnu-as --disable-multilib --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r14-7258-20240115151353-g731444b3c39-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240115 (experimental) (GCC)
Comment 1 Andrew Pinski 2024-01-17 02:55:17 UTC
I thought I saw something similar before for aarch64 and SVE. Maybe OpenMP .
Comment 2 Andrew Pinski 2024-01-17 03:00:34 UTC
Confirmed.

Also fails a similar way with ARMv9-a's SVE:
```
#include <arm_sve.h>

void
f(char* out, int n, svint8_t v2)
{
  for (int i = 0; i < n; i++) {
    *(svint8_t *)(out + i) = v2;
  }
}
```

Compile with ` -O2 -g0 -march=armv9-a -ftree-parallelize-loops=2`.