public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108166] New: [12/13 Regression] Wrong code with -O2
@ 2022-12-18 19:46 vsevolod.livinskiy at gmail dot com
  2022-12-18 21:08 ` [Bug tree-optimization/108166] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: vsevolod.livinskiy at gmail dot com @ 2022-12-18 19:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108166
           Summary: [12/13 Regression] Wrong code with -O2
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskiy at gmail dot com
  Target Milestone: ---

Link to the Compiler Explorer: https://godbolt.org/z/j8coqj375

Reproducer:
#include <stdio.h>
bool a, b;
int d, c;
const int &e(const int &f, const int &g) { return !f ? f : g; }
int main() {
  c = e(b, 0) > ((b ? d : b) ?: 8);
  a = b ? d : b;
  printf("%d\n", a);
  if (a != 0)
    __builtin_abort();
}

Error:
>$ g++ -O2 driver.cpp && ./a.out 
1
Aborted (core dumped)
>$ g++ -O0 driver.cpp && ./a.out 
0

gcc version 13.0.0 20221216 (2fdc8546b5c6cb1fe254e40b5bdd19ed6fbb44da)

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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-18 19:46 [Bug tree-optimization/108166] New: [12/13 Regression] Wrong code with -O2 vsevolod.livinskiy at gmail dot com
2022-12-18 21:08 ` [Bug tree-optimization/108166] " pinskia at gcc dot gnu.org
2022-12-19  8:17 ` rguenth at gcc dot gnu.org
2022-12-19  8:34 ` [Bug tree-optimization/108166] [12/13 Regression] Wrong code with -O2 since r12-8078-ga42aa68bf1ad745a marxin at gcc dot gnu.org
2022-12-19 13:13 ` jakub at gcc dot gnu.org
2022-12-21 12:52 ` jakub at gcc dot gnu.org
2022-12-21 13:12 ` rguenth at gcc dot gnu.org
2022-12-21 13:14 ` rguenth at gcc dot gnu.org
2022-12-21 13:35 ` jakub at gcc dot gnu.org
2022-12-22 11:53 ` cvs-commit at gcc dot gnu.org
2022-12-22 11:55 ` [Bug tree-optimization/108166] [12 " jakub at gcc dot gnu.org
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:59 ` jakub at gcc dot gnu.org
2024-02-01 22:16 ` 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).