public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103986] New: Miscompilation with -O2 -funswitch-loops and __builtin_unreachable in ternary operator
@ 2022-01-12  3:38 daniel at constexpr dot org
  2022-01-12  3:54 ` [Bug tree-optimization/103986] [9/10 Regression] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: daniel at constexpr dot org @ 2022-01-12  3:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103986
           Summary: Miscompilation with -O2 -funswitch-loops and
                    __builtin_unreachable in ternary operator
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel at constexpr dot org
  Target Milestone: ---

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

The loop in the attached reduced test case does not terminate when compiled
with -O3 or -O2 -funswitch-loops with GCC 9.4.0 or GCC 10.3.1 even though it
should only iterate 144 times.

Curiously, the programs works as expected when using an if() instead of the
ternary operator in the assume macro but maybe that's just luck.

I could not reproduce the issue with GCC 8.5.0, GCC 11.2.1 or my GCC 12
checkout from 20220102.

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

end of thread, other threads:[~2022-01-12  8:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12  3:38 [Bug tree-optimization/103986] New: Miscompilation with -O2 -funswitch-loops and __builtin_unreachable in ternary operator daniel at constexpr dot org
2022-01-12  3:54 ` [Bug tree-optimization/103986] [9/10 Regression] " pinskia at gcc dot gnu.org
2022-01-12  3:54 ` pinskia at gcc dot gnu.org
2022-01-12  3:59 ` [Bug tree-optimization/103986] [9/10 Regression] Miscompilation with -O2 -funswitch-loops and __builtin_unreachable pinskia at gcc dot gnu.org
2022-01-12  4:05 ` pinskia at gcc dot gnu.org
2022-01-12  6:29 ` pinskia at gcc dot gnu.org
2022-01-12  6:36 ` pinskia at gcc dot gnu.org
2022-01-12  6:38 ` pinskia at gcc dot gnu.org
2022-01-12  7:08 ` pinskia at gcc dot gnu.org
2022-01-12  7:11 ` pinskia at gcc dot gnu.org
2022-01-12  8:17 ` rguenth at gcc dot gnu.org
2022-01-12  8:20 ` rguenth 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).