--- Comment #7 from manu at gcc dot gnu dot org 2009-07-09 15:35 ---
@Jacob,
The C/C++ standards have some precise rules of what can and cannot be done
about pointer casts.
See
http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Optimize-Options.html#index-fstrict_002daliasing-749
See also th
--- Comment #6 from rguenth at gcc dot gnu dot org 2009-07-09 15:26 ---
g++-4.1 -S t.C -O2 -m32 -Wall
t.C: In function ‘TwoPointers InterlockedExchange(TwoPointers*, TwoPointers)’:
t.C:60: warning: dereferencing type-punned pointer will break strict-aliasing
rules
t.C:60: warning: derefe
--- Comment #5 from jacob at jacob dot remcomp dot fr 2009-07-09 14:34
---
What do you mean by "aliasing violations" ???
Why would that code be invalid without any warning from the compiler?
It took us a lot of work for finding this bug and reporting it to you
can you explain?
Thanks
--- Comment #4 from jakub at gcc dot gnu dot org 2009-07-09 13:50 ---
The code has a bunch of aliasing violations, so is invalid.
*** This bug has been marked as a duplicate of 21920 ***
--
jakub at gcc dot gnu dot org changed:
What|Removed |Added
--- Comment #3 from jacob at jacob dot remcomp dot fr 2009-07-09 13:18
---
Created an attachment (id=18169)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18169&action=view)
script that demonstrates the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40698
--- Comment #2 from jacob at jacob dot remcomp dot fr 2009-07-09 13:18
---
Created an attachment (id=18168)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18168&action=view)
Needed for linking the cpp code
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40698
--- Comment #1 from jacob at jacob dot remcomp dot fr 2009-07-09 13:17
---
Created an attachment (id=18167)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18167&action=view)
This is the cpp source needed to reproduce the bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40698