[Bug c++/34295] Bad optimization in an inlined method
dvt at isoft dot fr
gcc-bugzilla@gcc.gnu.org
Thu Nov 29 17:09:00 GMT 2007
------- Comment #2 from dvt at isoft dot fr 2007-11-29 17:09 -------
(In reply to comment #1)
> You are violating C aliasing rules. Use memcpy (as you did) or a union to
> guard
> the type punning.
> *** This bug has been marked as a duplicate of 21920 ***
Are-you sure? Were is the rule that forbids to do this?
And even if this is the case, this is for us a crucial matter of optimization:
other compilers allow that, and optimize this cast. If gcc cannot do that
(which also means that you (double*)(void*)(&d) should not work too), it should
at least provide a way to do such an operation more efficiently that doing a
memcpy!
An how do-you explain that without optimization it works, then?
For us, it is a big problem, and this means that we cannot really rely on gcc!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34295
More information about the Gcc-bugs
mailing list