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

palmer at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-06-21
     Ever confirmed|0                           |1
                 CC|                            |palmer at gcc dot gnu.org

--- Comment #3 from palmer at gcc dot gnu.org ---
I can confirm this is a bug.  The shortest reproducer I can get is:

$ cat test.c
volatile float f[2];
int x[2];

float fconv(int x);

void func() {
  x[0] = -1;
  x[1] = 2; // Removal of this line avoids the bug

  for (int i = 0; i < 1; ++i)
    f[i] = x[i];
}
$ ./toolchain/install/bin/riscv64-unknown-linux-gnu-gcc test.c -S -o-
-march=rv64imac -mabi=lp64 -O1 -ftree-slp-vectorize -funroll-loops
-fdump-rtl-all
...
func:
        addi    sp,sp,-16
        sd      ra,8(sp)
        li      a0,3
        slli    ra,a0,32
        addi    a0,ra,-1
        lui     a5,%hi(x)
        sd      a0,%lo(x)(a5)
        call    __floatsisf
        lui     t0,%hi(f)
        sw      a0,%lo(f)(t0)
        ld      ra,8(sp)
        addi    sp,sp,16
        jr      ra
...

With the bug being that a0 contains a non-ABI-canonical value at the call to
__floatsisf.

Reply via email to