Bug 33294 - [4.2/4.3 Regression] -fno-strict-aliasing -ftree-vrp miscompilation
Summary: [4.2/4.3 Regression] -fno-strict-aliasing -ftree-vrp miscompilation
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2007-09-03 17:46 UTC by Serge Belyshev
Modified: 2007-09-03 18:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Belyshev 2007-09-03 17:46:10 UTC
Compile with "-O2 -fno-strict-aliasing", fails on amd64 and alpha at least.  Doesn't fail with -fno-tree-vrp.  Seems to be related to bug 32575.  Breaks linux kernel in many places (this asm is used with prefetch instruction).


struct T { void *p; } *t;

int main (void)
{
  struct T *a;

  a = t;
  asm volatile ("" : : "m" (*(unsigned long *) a));
  if (a)
    __builtin_abort ();
  return 0;
}
Comment 1 Serge Belyshev 2007-09-03 18:13:58 UTC
This bug is invalid because asm() does NULL pointer dereference, thus triggering undefined behavior.