public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/116278] New: [15] RISC-V: Miscompile at -O2 -fwrapv -fno-strict-aliasing
@ 2024-08-08  0:46 patrick at rivosinc dot com
  2024-08-08  1:01 ` [Bug target/116278] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: patrick at rivosinc dot com @ 2024-08-08  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116278
           Summary: [15] RISC-V: Miscompile at -O2 -fwrapv
                    -fno-strict-aliasing
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
signed char b[1];
int c;
signed char *d = b;
int main() {
  b[0] = -40;
  c = ({ (unsigned short)d[0] < 0xFFF6 ? (unsigned short)d[0] : 0xFFF6; }) + 9;
  __builtin_printf("%d\n", c);
}

Commands:
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc -O2 -fwrapv -fno-strict-aliasing red.c -o red.out
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/qemu-riscv64 red.out
65535
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc -O1 -fwrapv -fno-strict-aliasing red.c -o red.out
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/qemu-riscv64 red.out
65505

Found via fuzzer

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

end of thread, other threads:[~2024-09-02  4:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-08  0:46 [Bug target/116278] New: [15] RISC-V: Miscompile at -O2 -fwrapv -fno-strict-aliasing patrick at rivosinc dot com
2024-08-08  1:01 ` [Bug target/116278] " pinskia at gcc dot gnu.org
2024-08-08  1:17 ` kito at gcc dot gnu.org
2024-08-08  1:21 ` pan2.li at intel dot com
2024-08-08  1:21 ` pinskia at gcc dot gnu.org
2024-08-08  1:42 ` pan2.li at intel dot com
2024-08-08  2:13 ` pan2.li at intel dot com
2024-08-08  2:30 ` pan2.li at intel dot com
2024-08-08  3:19 ` pan2.li at intel dot com
2024-08-18  1:28 ` cvs-commit at gcc dot gnu.org
2024-08-18  3:49 ` sjames at gcc dot gnu.org
2024-08-18  4:12 ` pan2.li at intel dot com
2024-08-18  5:32 ` sjames at gcc dot gnu.org
2024-08-28  8:09 ` cvs-commit at gcc dot gnu.org
2024-09-02  4:43 ` law 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).