The following fails: $ arm-eabi-gcc -c -xc++ gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c -march=armv8.1-m.main+mve -mfloat-abi=hard -mtune=cortex-m7 -O3 during RTL pass: reload In file included from gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c:5: gcc/testsuite/c-c++-common/torture/vshuf-main.inc: In function 'int main()': gcc/testsuite/c-c++-common/torture/vshuf-main.inc:26:1: internal compiler error: in lra_assign, at lra-assigns.c:1649 26 | } | ^ 0xe2d8fe lra_assign(bool&) /home/alecop01/toolchain/src/gcc/gcc/lra-assigns.c:1649 0xe298f2 lra(_IO_FILE*) /home/alecop01/toolchain/src/gcc/gcc/lra.c:2387 0xddb586 do_reload /home/alecop01/toolchain/src/gcc/gcc/ira.c:5835 0xddb586 execute /home/alecop01/toolchain/src/gcc/gcc/ira.c:6021 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. On the GCC 10 branch, we ICE even without the -mtune option (the default scheduling for MVE changed for GCC 11).
This one: int a, b, c; int d() { long e[210] = {}; long long f[9][1]; long g = c = 0; for (; c < 9; c++) f[c][0] = 9; if (f[4][0]) { long h = (int)&g; a = h; if (b) return (int)e; } } fails in the same way with -march=armv8.1-m.main+mve -mfloat-abi=hard -O -ftree-vectorize -mpure-code -funroll-all-loops.
We are still seeing this ICE in the Linaro CI: spawn -ignore SIGHUP /path/to/install/bin/arm-eabi-g++ /path/to/gcc.git/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c -mthumb -march=armv8.1-m.main+mve.fp+fp.dp -mtune=cortex-m55 -mfloat-abi=hard -mfpu=auto -fdiagnostics-plain-output -nostdinc++ -I/path/to/builds/x86_64-pc-linux-gnu/arm-eabi/gcc-gcc.git~master-stage2/arm-eabi/libstdc++-v3/include/arm-eabi -I/path/to/builds/x86_64-pc-linux-gnu/arm-eabi/gcc-gcc.git~master-stage2/arm-eabi/libstdc++-v3/include -I/path/to/gcc.git/libstdc++-v3/libsupc++ -I/path/to/gcc.git/libstdc++-v3/include/backward -I/path/to/gcc.git/libstdc++-v3/testsuite/util -fmessage-length=0 -O3 -g -S -o vshuf-v16qi.s during RTL pass: reload In file included from /path/to/gcc.git/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c:5: /path/to/gcc.git/gcc/testsuite/c-c++-common/torture/vshuf-main.inc: In function 'int main()': /path/to/gcc.git/gcc/testsuite/c-c++-common/torture/vshuf-main.inc:26:1: internal compiler error: in lra_assign, at lra-assigns.cc:1657 0x10c07d1 lra_assign(bool&) ../../../../../../gcc/gcc/lra-assigns.cc:1657 0x10ba784 lra(_IO_FILE*, int) ../../../../../../gcc/gcc/lra.cc:2493 0x106fa8f do_reload ../../../../../../gcc/gcc/ira.cc:5973 0x106fa8f execute ../../../../../../gcc/gcc/ira.cc:6161 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. compiler exited with status 1 This is with trunk from March 8, commit cebbaa2a8458 ("[PR113790][LRA]: Fixing LRA ICE on riscv64") The same problem also happens in other related tests: FAIL: c-c++-common/torture/vshuf-v2di.c -O3 -g (internal compiler error: in lra_assign, at lra-assigns.cc:1657) FAIL: c-c++-common/torture/vshuf-v4sf.c -O3 -g (internal compiler error: in lra_assign, at lra-assigns.cc:1657) FAIL: c-c++-common/torture/vshuf-v4si.c -O3 -g (internal compiler error: in lra_assign, at lra-assigns.cc:1657) FAIL: c-c++-common/torture/vshuf-v8hi.c -O3 -g (internal compiler error: in lra_assign, at lra-assigns.cc:1657) GCC is configured with: /path/to/gcc.git/configure \ SHELL=/bin/bash \ --with-mpc=/path/to/install \ --with-mpfr=/path/to/install \ --with-gmp=/path/to/install \ --with-gnu-as \ --with-gnu-ld \ --disable-libmudflap \ --enable-lto \ --enable-shared \ --without-included-gettext \ --enable-nls \ --with-system-zlib \ --disable-sjlj-exceptions \ --enable-gnu-unique-object \ --enable-linker-build-id \ --disable-libstdcxx-pch \ --enable-c99 \ --enable-clocale=gnu \ --enable-libstdcxx-debug \ --enable-long-long \ --with-cloog=no \ --with-ppl=no \ --with-isl=no \ --enable-threads=no \ --disable-multiarch \ --disable-multilib \ --with-mode=thumb \ --with-arch=armv8.1-m.main+mve.fp+fp.dp \ --with-float=hard \ --with-sysroot=/path/to/install/arm-eabi \ --with-headers=yes \ --with-native-system-header-dir=/include \ --with-newlib \ --enable-checking=yes \ --disable-bootstrap \ --enable-languages=c,c++,lto \ --prefix=/path/to/install \ --build=x86_64-pc-linux-gnu \ --host=x86_64-pc-linux-gnu \ --target=arm-eabi
Hi Vladimir, Could you take a look at this, please?
(In reply to Maxim Kuvyrkov from comment #3) > Hi Vladimir, > > Could you take a look at this, please? I already got a message from automatic linaro tester yesterday about the new test failures and looked at them. I was not able to reproduce them but after I looked at the provided log files. I see that the tests failed because of timeout. My recent patch resulted in LRA doing a bit more job and therefore the tests (all with -O3) failed because of the timeout. I'd recommend to increase the timeout threshold for the tester.
Hi Vladimir, The email you got from Linaro CI was about tests the ICE changing "names" due to assert in lra-assigns.cc changing line numbers. E.g., FAIL: c-c++-common/torture/vshuf-v16qi.c -O3 -g (internal compiler error: in lra_assign, at lra-assigns.cc:1651) ... becoming ... FAIL: c-c++-common/torture/vshuf-v16qi.c -O3 -g (internal compiler error: in lra_assign, at lra-assigns.cc:1657) These are not real regressions, and that report can be ignored. This PR though, is about fixing the ICE triggered by this test. We are seeing the ICEs using these configure options: https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m55_hard_eabi-build/lastSuccessfulBuild/artifact/artifacts/notify/configure-make.txt/*view*/ . Where did you see the timeouts, btw?
Created attachment 57683 [details] Preprocessed source file. I was able to reproduce the ICE on my x86_64 laptop with the following commands. There's no timeout problem involved. I'm attaching the Preprocessed source file. $ mkdir -p ~/.cache/builds/combined-tree-src $ mkdir -p ~/.cache/builds/combined-tree-arm-eabi $ cd ~/src/newlib-cygwin && find . -print | cpio -pdlm ~/.cache/builds/combined-tree-src $ cd ~/src/binutils-gdb && find . -print | cpio -pdlmu ~/.cache/builds/combined-tree-src $ cd ~/src/gcc && find . -print | cpio -pdlmu ~/.cache/builds/combined-tree-src $ cd ~/.cache/builds/combined-tree-arm-eabi $ ../combined-tree-src/configure \ SHELL=/bin/bash \ --with-gnu-as \ --with-gnu-ld \ --disable-libmudflap \ --disable-gdb \ --disable-gprof \ --disable-gprofng \ --enable-lto \ --enable-shared \ --without-included-gettext \ --enable-nls \ --with-system-zlib \ --disable-sjlj-exceptions \ --enable-gnu-unique-object \ --enable-linker-build-id \ --disable-libstdcxx-pch \ --enable-c99 \ --enable-clocale=gnu \ --enable-libstdcxx-debug \ --enable-long-long \ --with-cloog=no \ --with-ppl=no \ --with-isl=no \ --enable-threads=no \ --disable-multiarch \ --disable-multilib \ --with-mode=thumb \ --with-arch=armv8.1-m.main+mve.fp+fp.dp \ --with-float=hard \ --with-sysroot=/tmp/install/arm-eabi \ --with-headers=yes \ --with-native-system-header-dir=/include \ --with-newlib \ --enable-checking=yes \ --disable-bootstrap \ --enable-languages=c,c++,lto \ --prefix=/tmp/install \ --build=x86_64-pc-linux-gnu \ --host=x86_64-pc-linux-gnu \ --target=arm-eabi $ make \ SHELL=/bin/bash \ -w \ -j 8 \ LDFLAGS_FOR_TARGET=" --specs=rdimon.specs" \ CFLAGS_FOR_BUILD="-pipe -g -O2" \ CXXFLAGS_FOR_BUILD="-pipe -g -O2" \ LDFLAGS_FOR_BUILD="-static-libgcc" \ MAKEINFOFLAGS=--force $ /home/bauermann/.cache/builds/combined-tree-arm-eabi/gcc/testsuite/g++/../../xg++ \ -B/home/bauermann/.cache/builds/combined-tree-arm-eabi/gcc/testsuite/g++/../../ \ /home/bauermann/.cache/builds/combined-tree-src/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c \ -fdiagnostics-plain-output \ -nostdinc++ \ -I/home/bauermann/.cache/builds/combined-tree-arm-eabi/arm-eabi/libstdc++-v3/include/arm-eabi \ -I/home/bauermann/.cache/builds/combined-tree-arm-eabi/arm-eabi/libstdc++-v3/include \ -I/home/bauermann/.cache/builds/combined-tree-src/libstdc++-v3/libsupc++ \ -I/home/bauermann/.cache/builds/combined-tree-src/libstdc++-v3/include/backward \ -I/home/bauermann/.cache/builds/combined-tree-src/libstdc++-v3/testsuite/util \ -fmessage-length=0 \ -O3 \ -g \ -S \ -o vshuf-v16qi.s during RTL pass: reload In file included from /home/bauermann/.cache/builds/combined-tree-src/gcc/testsuite/c-c++-common/torture/vshuf-v16qi.c:5: /home/bauermann/.cache/builds/combined-tree-src/gcc/testsuite/c-c++-common/torture/vshuf-main.inc: In function ‘int main()’: /home/bauermann/.cache/builds/combined-tree-src/gcc/testsuite/c-c++-common/torture/vshuf-main.inc:26:1: internal compiler error: in lra_assign, at lra-assigns.cc:1657 0x10b2b19 lra_assign(bool&) ../../combined-tree-src/gcc/lra-assigns.cc:1657 0x10acf3f lra(_IO_FILE*, int) ../../combined-tree-src/gcc/lra.cc:2493 0x10617ef do_reload ../../combined-tree-src/gcc/ira.cc:5973 0x10617ef execute ../../combined-tree-src/gcc/ira.cc:6161 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.
(In reply to Maxim Kuvyrkov from comment #5) > > Where did you see the timeouts, btw? Sorry, I glanced at c logs and interpreted it wrongly. Please, discard my previous comment. I should been more accurate with reading the PR. I've tried c compiler instead of c++ one. Therefore I did not reproduce the bug. But the bug is really present for c++ compiler. I'll work on this PR and try to fix this on this or the next week.
The master branch has been updated by Vladimir Makarov <vmakarov@gcc.gnu.org>: https://gcc.gnu.org/g:9c91f8a88b2db50c8faf70786d3cef27b39ac9fc commit r14-9557-g9c91f8a88b2db50c8faf70786d3cef27b39ac9fc Author: Vladimir N. Makarov <vmakarov@redhat.com> Date: Tue Mar 19 16:57:11 2024 -0400 [PR99829][LRA]: Fixing LRA ICE on arm LRA removed insn setting equivalence to memory whose output was reloaded. This resulted in writing an uninitiated value to the memory which triggered assert in LRA code checking the final generated code. This patch fixes the problem. Comment in the patch contains more details about the problem and its solution. gcc/ChangeLog: PR target/99829 * lra-constraints.cc (lra_constraints): Prevent removing insn with reverse equivalence to memory if the memory was reloaded.
Hello Vladimir, Sorry for the delay in getting back to this. (In reply to GCC Commits from comment #8) > The master branch has been updated by Vladimir Makarov > <vmakarov@gcc.gnu.org>: > > https://gcc.gnu.org/g:9c91f8a88b2db50c8faf70786d3cef27b39ac9fc > > commit r14-9557-g9c91f8a88b2db50c8faf70786d3cef27b39ac9fc > Author: Vladimir N. Makarov <vmakarov@redhat.com> > Date: Tue Mar 19 16:57:11 2024 -0400 > > [PR99829][LRA]: Fixing LRA ICE on arm I can confirm that the commit fixes this bug. Thank you!