public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/107107] New: Wrong codegen from TBAA when stores to distinct same-mode types are collapsed?
@ 2022-09-30 21:34 bugdal at aerifal dot cx
  2022-10-01  2:25 ` [Bug middle-end/107107] " bugdal at aerifal dot cx
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: bugdal at aerifal dot cx @ 2022-09-30 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107107
           Summary: Wrong codegen from TBAA when stores to distinct
                    same-mode types are collapsed?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugdal at aerifal dot cx
  Target Milestone: ---

Created attachment 53646
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53646&action=edit
original test case by supercat

The attached test case is from user supercat on Stack Overflow (original
source:
https://stackoverflow.com/questions/42178179/will-casting-around-sockaddr-storage-and-sockaddr-in-break-strict-aliasing/42178347?noredirect=1#comment130509588_42178347,
https://godbolt.org/z/83v4ssrn4) and demonstrates wrong TBAA apparently
assuming an object of type long long was not modified after the code path
modifying it was collapsed with a different code path performing the
modification via an lvalue of type long.

On 64-bit targets, the test program outputs 1/2 with optimization levels that
enable -fstrict-aliasing. The expected output is 2/2. Using
-fno-strict-aliasing fixes it.

I have not checked this myself, but according to others who have looked at the
test case, the regression came between GCC 4.7 and 4.8.

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

end of thread, other threads:[~2023-01-26 13:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 21:34 [Bug middle-end/107107] New: Wrong codegen from TBAA when stores to distinct same-mode types are collapsed? bugdal at aerifal dot cx
2022-10-01  2:25 ` [Bug middle-end/107107] " bugdal at aerifal dot cx
2022-10-01  2:59 ` pinskia at gcc dot gnu.org
2022-10-01  3:02 ` pinskia at gcc dot gnu.org
2022-10-01  3:05 ` [Bug tree-optimization/107107] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-10-01  3:05 ` pinskia at gcc dot gnu.org
2022-10-01 17:08 ` amonakov at gcc dot gnu.org
2022-10-01 20:01 ` bugdal at aerifal dot cx
2022-10-06  9:02 ` rguenth at gcc dot gnu.org
2022-10-06  9:22 ` rguenth at gcc dot gnu.org
2022-10-06 10:07 ` cvs-commit at gcc dot gnu.org
2022-10-06 10:08 ` [Bug tree-optimization/107107] [10/11/12 " rguenth at gcc dot gnu.org
2022-10-17 13:10 ` cvs-commit at gcc dot gnu.org
2022-12-12 16:33 ` [Bug tree-optimization/107107] [10/11 " cvs-commit at gcc dot gnu.org
2023-01-26 13:05 ` [Bug tree-optimization/107107] [10 " cvs-commit at gcc dot gnu.org
2023-01-26 13:06 ` 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).