]> gcc.gnu.org Git - gcc.git/commit
RISC-V: Fix Zicond ICE on large constants
authorTsukasa OI <research_trasio@irq.a4lg.com>
Sun, 3 Sep 2023 12:39:47 +0000 (12:39 +0000)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Wed, 6 Sep 2023 02:00:13 +0000 (02:00 +0000)
commitce65641354d98fc80912d5516b7fea87c344c2cc
tree010c76ef84279845f444861261f25a062f96b4e9
parent4388bc8213a713047fbaac2ca438c8233cde03f5
RISC-V: Fix Zicond ICE on large constants

Large constant cons and/or alt will trigger ICEs building GCC target
libraries (libgomp and libatomic) when the 'Zicond' extension is enabled.

For instance, zicond-ice-2.c (new test case in this commit) will cause
an ICE when SOME_NUMBER is 0x1000 or larger.  While opposite numbers
corresponding cons/alt (two temp2 variables) are checked, cons/alt
themselves are not checked and causing 2 ICEs building
GCC target libraries as of this writing:

1.  gcc/libatomic/config/posix/lock.c
2.  gcc/libgomp/fortran.c

Coercing a large value into a register will fix the issue.

It also coerce a large cons into a register on "imm, imm" case (the author
could not reproduce but possible to cause an ICE).

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_expand_conditional_move): Force
large constant cons/alt into a register.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/zicond-ice-2.c: New test.  This is based on
an ICE at libat_lock_n func on gcc/libatomic/config/posix/lock.c
but heavily minimized.
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/zicond-ice-2.c [new file with mode: 0644]
This page took 0.063711 seconds and 5 git commands to generate.