This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34295] Bad optimization in an inlined method
- From: "dvt at isoft dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Nov 2007 17:09:36 -0000
- Subject: [Bug c++/34295] Bad optimization in an inlined method
- References: <bug-34295-15458@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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