public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101641] New: Bogus redundant store removal
@ 2021-07-27 12:03 rguenth at gcc dot gnu.org
  2021-07-27 12:08 ` [Bug tree-optimization/101641] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-27 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101641
           Summary: Bogus redundant store removal
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

union u {
  long x;
  long long y;
};

__attribute__((noinline,noclone))
long test(long *px, long long *py, union u *pu)
{
  *px = 0;
  *py = 1;

  long xy = pu->y;
  pu->x = xy;

  return *px;
}

int main ()
{    
  union u u;
  if (test (&u.x, &u.y, &u) != 1)
    __builtin_abort ();
  return 0;
}

is miscompiled at -O2+ as FRE removes the seemingly redundant store to
pu->x but that's needed to make the read via *px pick up the value stored
via *py = 1 rather than (correctly) disambiguating against that and
running into *px = 0.

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

end of thread, other threads:[~2021-09-28 10:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 12:03 [Bug tree-optimization/101641] New: Bogus redundant store removal rguenth at gcc dot gnu.org
2021-07-27 12:08 ` [Bug tree-optimization/101641] " rguenth at gcc dot gnu.org
2021-07-29  8:09 ` rguenth at gcc dot gnu.org
2021-07-29  8:55 ` rguenth at gcc dot gnu.org
2021-07-29  9:07 ` rguenth at gcc dot gnu.org
2021-07-29 18:04 ` muecker at gwdg dot de
2021-09-10  8:05 ` rguenth at gcc dot gnu.org
2021-09-28 10: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).