This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32697] O2 optimizes away assignment
- From: "sorenj at us dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2007 13:55:53 -0000
- Subject: [Bug c++/32697] O2 optimizes away assignment
- References: <bug-32697-14825@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from sorenj at us dot ibm dot com 2007-07-09 13:55 -------
Please refer to
https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1560993&group_id=1645
Long story short - as it stands today: C++ standards team won't change the spec
to allow type punning, gcc team won't "fix" code generation if it involves type
punning, swig team won't rewrite the code generators to generate ANSI spec
compliant code.
(The only way to do this by current ANSI spec rules is to memcpy the contents
of the pointers themselves from a pointer of one type to a pointer of another
type.)
Your only solution at this time is to use -fno-strict-aliasing when compiling
swig wrapper code. This has been a major headache mainly for package
maintainers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32697