This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/42179] Incorrect optimization (-O2) yields wrong code (regression)



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-11-26 09:56 -------
Aliasing rules are indeed broken because you access a union of anonymous type
through a pointer to a union of type ieee_double_extract. 

I think you want

  union { union ieee_double_extract d; unsigned long long i; } x;

  x.d.d = 0.0 / 0.0;
  printf ("d = %g [%llx]\n", x.d.d, x.d.i);
  printf ("exp = %x\n", (unsigned int) x.d.s.exp);
  return 0;

or even simplified.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]