public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114666] New: [14 Regression] Signed single bit comparison miscompile at -O2
@ 2024-04-09 20:10 patrick at rivosinc dot com
  2024-04-09 20:11 ` [Bug middle-end/114666] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: patrick at rivosinc dot com @ 2024-04-09 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114666
           Summary: [14 Regression] Signed single bit comparison
                    miscompile at -O2
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
struct {
  signed a : 1;
} b = {-1};
char c;
int main()
{
  if ((b.a ^ 1UL) < 3)
    __builtin_abort();
}

Commands:
> /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -O2 red.c -o red.out
> /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/qemu-riscv64 red.out
zsh: IOT instruction (core dumped) 
/scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/qemu-riscv64 red.out

> /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc -O1 red.c -o red.out
> /scratch/tc-testing/tc-apr-9/build-rv64gcv/bin/qemu-riscv64 red.out
> echo $?
0

Godbolt showing the same issue on x86: https://godbolt.org/z/1dx8YKG3e

Discovered/tested using r14-9877-g1f719aa7c0d (not bisected)

Found via fuzzer.

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

end of thread, other threads:[~2024-04-12 17:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 20:10 [Bug middle-end/114666] New: [14 Regression] Signed single bit comparison miscompile at -O2 patrick at rivosinc dot com
2024-04-09 20:11 ` [Bug middle-end/114666] " pinskia at gcc dot gnu.org
2024-04-09 20:16 ` pinskia at gcc dot gnu.org
2024-04-09 20:35 ` [Bug tree-optimization/114666] " pinskia at gcc dot gnu.org
2024-04-09 20:49 ` pinskia at gcc dot gnu.org
2024-04-09 21:03 ` pinskia at gcc dot gnu.org
2024-04-09 21:11 ` pinskia at gcc dot gnu.org
2024-04-09 22:58 ` pinskia at gcc dot gnu.org
2024-04-10 22:04 ` pinskia at gcc dot gnu.org
2024-04-11  1:10 ` pinskia at gcc dot gnu.org
2024-04-12 17:57 ` cvs-commit at gcc dot gnu.org
2024-04-12 17:57 ` pinskia 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).