--- Comment #11 from dino at concisoft dot com 2008-06-06 21:13 ---
Created an attachment (id=15727)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15727&action=view)
A relatively simple self contained piece of code that reproduces the problem.
Please see the comments
--- Comment #9 from dino at concisoft dot com 2008-05-07 06:15 ---
Understood. Just haven't been able to reproduce on a small piece of code :-(
It seems GNU C++ compiler doesn't give strict-aliasing warnings.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36149
--- Comment #7 from dino at concisoft dot com 2008-05-06 16:54 ---
-O2 -fno-strict-aliasing does work.
I think the LC and LLC functions always cast from a derived class to a base
class. That shouldn't cause aliasing problems, but I need to learn more about
that.
Thanks.
--
--- Comment #5 from dino at concisoft dot com 2008-05-06 15:42 ---
Are we missing a const, or would you care to give a bit more specific comment?
I see that:
template static const LINK* LCC(Y* X) {
return static_cast(X);
}
could be missing a const in the declaration
--- Comment #3 from dino at concisoft dot com 2008-05-06 14:18 ---
template static LINK* LC(Y* X) {
return static_cast(X);
}
template static const LINK* LCC(Y* X) {
return static_cast(X);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36149
--- Comment #1 from dino at concisoft dot com 2008-05-06 07:19 ---
The same code works fine with -O1 and -O3.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36149
aps
provide additional info.
--
Summary: -O2 optimization generates wrong code
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dino at concisoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36149