Bug 33294

Summary: [4.2/4.3 Regression] -fno-strict-aliasing -ftree-vrp miscompilation
Product: gcc Reporter: Serge Belyshev <belyshev>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: gcc-bugs
Priority: P3 Keywords: wrong-code
Version: 4.3.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

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.