public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108439] New: incorrect optimization with -O2, -O3, -Os
@ 2023-01-17 21:17 georgmueller at gmx dot net
  2023-01-17 21:22 ` [Bug c/108439] " georgmueller at gmx dot net
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: georgmueller at gmx dot net @ 2023-01-17 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108439
           Summary: incorrect optimization with -O2, -O3, -Os
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: georgmueller at gmx dot net
  Target Milestone: ---

Created attachment 54292
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54292&action=edit
test case to trigger bug

When testing the crap8 (or crapwow) hashing funtion, we discovered a gcc
optimization problem with gcc from at least version 9.3.0 up to 12.2.1.

The attached program (t_crap8.c) miscompiles for -O2, -O3, -Os while testing
the crap8 hash function (same behavior with similar hash function crapwow,
which only has different parameters m and n in the hash function).

Implementation is, for example. available in the smhasher project.

The line "lb_key[0] = 0x1234;" gets ignored with -O2, -O3, -Os.

As described in the report, compiling with -fno-strict-aliasing solves the
problem, but the code is compiling correctly with clang at all optimization
levels and does not report an error.

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

end of thread, other threads:[~2023-01-18  9:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 21:17 [Bug c/108439] New: incorrect optimization with -O2, -O3, -Os georgmueller at gmx dot net
2023-01-17 21:22 ` [Bug c/108439] " georgmueller at gmx dot net
2023-01-17 21:25 ` georgmueller at gmx dot net
2023-01-17 21:32 ` pinskia at gcc dot gnu.org
2023-01-17 21:33 ` pinskia at gcc dot gnu.org
2023-01-17 21:44 ` georgmueller at gmx dot net
2023-01-17 21:51 ` pinskia at gcc dot gnu.org
2023-01-18  9:01 ` georgmueller at gmx dot net

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).