--- Comment #6 from drow at gcc dot gnu dot org 2005-11-30 16:02 ---
However, I think this is a convincing reason for the patch to merged to at
least 4.1.0.
--
drow at gcc dot gnu dot org changed:
What|Removed |Added
--- Comment #1 from frederic dot devernay at m4x dot org 2005-11-29 13:30
---
Created an attachment (id=10361)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10361action=view)
test case
this source generates wrong code without issueing a warning, using:
g++ -DMAIN -O
--- Comment #2 from pinskia at gcc dot gnu dot org 2005-11-29 15:12 ---
4.2 warns:
t.cc: In function 'CvStatus icvSet_8u_C4MR(int*, int, const uchar*, int,
CvSize, const int*)':
t.cc:21: warning: dereferencing type-punned pointer will break strict-aliasing
rules
Because the warning
--- Comment #3 from frederic dot devernay at m4x dot org 2005-11-29 17:42
---
I know it breaks aliasing rules, but this problem was not present in gcc-3.3.
Most gcc users consider -O2 as being a safe optimizing option, (e.g. redhat
RPMs are compiled with gcc -O2), and generating wrong
--- Comment #4 from pinskia at gcc dot gnu dot org 2005-11-29 17:47 ---
(In reply to comment #3)
I know it breaks aliasing rules, but this problem was not present in gcc-3.3.
So ...
GCC 4.1 includes more optimization than 3.3 did which takes advantage of the
aliasing rules.
Note
--- Comment #5 from bonzini at gnu dot org 2005-11-29 17:55 ---
Frederic, -Wstrict-aliasing is only working for C up until 4.1 (included).
Your code, rewritten to C, would issue a warning with 4.1 and earlier compilers
as well. Also note that -Wstrict-aliasing does not prevent the