https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124439
Bug ID: 124439
Summary: [16 regression] libgnat miscompiled on riscv64 since
r16-7891-g4bcf6c461a9b8f
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Blocks: 124041
Target Milestone: ---
Target: riscv64-*-*
$ ../gcc/configure --enable-languages=ada --target=riscv64-linux
$ make
$ cd gcc/ada/rts
$ ../../xgcc -B ../../ -gnatpg -O2 -S a-textio.adb
$ diff -u a-textio.s.{good,bad}
--- a-textio.s.good 2026-03-10 20:05:56.054768351 +0100
+++ a-textio.s.bad 2026-03-10 20:08:36.158990215 +0100
@@ -147,7 +147,7 @@
sub a4,a4,a3
add a0,a0,a4
beq a5,zero,.L21
- addi a4,sp,16
+ ld a4,8(sp)
subw a5,a5,a4
addiw a4,a5,1
mv a2,a5
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124041
[Bug 124041] [16 regression] ICE in lra_eliminate_regs_1, at
lra-eliminations.cc:665 since r16-1565