public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114386] New: [10/11/12 Regression] Miscompile at -O1
@ 2024-03-18 21:19 patrick at rivosinc dot com
  2024-03-18 21:25 ` [Bug tree-optimization/114386] [11/12 " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: patrick at rivosinc dot com @ 2024-03-18 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114386
           Summary: [10/11/12 Regression] Miscompile at -O1
           Product: gcc
           Version: 12.3.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:
int printf(const char *, ...);
_Bool a, c = 1;
int b, d;
int main() {
  _Bool g = c;
  d = !a ? ({ c > a ? c : a; }) : 0;
  printf("%x\n", d);
}

Commands:
> gcc -O0 red.c -o red.o
> ./red.o
0

> gcc -O1 red.c -o red.o
> ./red.o
1

> gcc -O2 red.c -o red.o
> ./red.o
0

> gcc -O3 red.c -o red.o
> ./red.o
1

Tested/discovered on x86 - gcc v11.4.0.
Issue is not present when targeting risc-v.

Godbolt shows it's a regression starting at 10.1 (with -O1) and resolved as of
13.1.

Godbolt: https://godbolt.org/z/q4P9xs5dx

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

end of thread, other threads:[~2024-03-18 22:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 21:19 [Bug target/114386] New: [10/11/12 Regression] Miscompile at -O1 patrick at rivosinc dot com
2024-03-18 21:25 ` [Bug tree-optimization/114386] [11/12 " pinskia at gcc dot gnu.org
2024-03-18 21:31 ` [Bug tree-optimization/114386] [11/12/13 " pinskia at gcc dot gnu.org
2024-03-18 21:36 ` pinskia at gcc dot gnu.org
2024-03-18 21:44 ` pinskia at gcc dot gnu.org
2024-03-18 21:55 ` patrick at rivosinc dot com
2024-03-18 21:57 ` pinskia at gcc dot gnu.org
2024-03-18 22:01 ` 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).