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++/34295] Bad optimization in an inlined method



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-11-29 17:21 -------
The recommended (and optimized) way to do this is:

union {
   INT64 i;
   double d;
} x;
x.d = arg;
return x.i;

you can also make your way work optimized by specifying -fno-strict-aliasing.
That it works without optimization is because with that or with -O1
-fno-strict-aliasing is default.


-- 


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


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