[Bug tree-optimization/37868] code that breaks TBAA is misoptimized even with -fno-strict-aliasing

sabre at nondot dot org gcc-bugzilla@gcc.gnu.org
Sat Oct 18 18:30:00 GMT 2008



------- Comment #1 from sabre at nondot dot org  2008-10-18 18:29 -------
Here is the testcase.  I should work with -fno-strict-aliasing:

#include <stdio.h>
#include <stdint.h>

struct X {
  unsigned char pad : 4;
  uint64_t a : 64;
  uint64_t b : 60;
} __attribute__((packed));

int main (void)
{
  struct X x;
  uint64_t bad_bits;

  x.pad = 255;
  x.a = -1ULL;
  x.b = -1ULL;

  bad_bits = ((uint64_t)-1ULL) ^ *(1+(uint64_t *) &x);
  printf("bad bits: %llx\n", bad_bits);
  return bad_bits != 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37868



More information about the Gcc-bugs mailing list