public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109989] New: RISC-V: Missing sign extension with int to float conversion with 64bit soft floats
@ 2023-05-26 13:53 joseph.faulls at imgtec dot com
  2023-06-01 10:35 ` [Bug target/109989] " maxim.blinov at imgtec dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: joseph.faulls at imgtec dot com @ 2023-05-26 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109989
           Summary: RISC-V: Missing sign extension with int to float
                    conversion with 64bit soft floats
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: joseph.faulls at imgtec dot com
  Target Milestone: ---

Created attachment 55166
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55166&action=edit
Preprocessed test

Hi,

This bug was discovered when running test
gcc.target/riscv/promote-type-for-libcall.c on O1 for march rv64imac.

There are a few moving parts to this, and I haven't been able to track down
where the bug lies due to not being at all familiar with gcc. But I've managed
to reduce the test to the following criteria:

Compilation flags:
-march=rv64imac -mabi=lp64 -O1 -ftree-slp-vectorize -funroll-loops

march can be any 64bit without f/d extension.
Removal of any of the other flags (with the given test case) will not cause the
bug.

I have confirmed the only difference between 12.1 and 13.1 is the missing sign
extension before the call to __floatsisf

Inlining the test file here for added comments:

#include <stdio.h>
#include <stdlib.h>
volatile float f[2];

int x[2] ;

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

  for (i=0;i<1;++i){
    f[i] = x[i]; // Any attempt to printf x[i] here avoids the bug
  }

  if (f[0] != -1.0f) {
    abort();
  }
  return 0;
}

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-21 16:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 13:53 [Bug tree-optimization/109989] New: RISC-V: Missing sign extension with int to float conversion with 64bit soft floats joseph.faulls at imgtec dot com
2023-06-01 10:35 ` [Bug target/109989] " maxim.blinov at imgtec dot com
2023-06-21  8:43 ` maxim.blinov at imgtec dot com
2023-06-21 16:56 ` palmer at gcc dot gnu.org
2023-06-21 16:59 ` palmer at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).