[Bug middle-end/36149] -O2 optimization generates wrong code

2008-06-06 Thread dino at concisoft dot com
--- 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=15727action=view) A relatively simple self contained piece of code that reproduces the problem. Please see the comments

[Bug c++/36149] -O2 optimization generates wrong code

2008-05-07 Thread dino at concisoft dot com
--- 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

[Bug c++/36149] New: -O2 optimization generates wrong code

2008-05-06 Thread dino at concisoft dot com
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

[Bug c++/36149] -O2 optimization generates wrong code

2008-05-06 Thread dino at concisoft dot com
--- 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

[Bug c++/36149] -O2 optimization generates wrong code

2008-05-06 Thread dino at concisoft dot com
--- Comment #3 from dino at concisoft dot com 2008-05-06 14:18 --- templateclass Y static LINK* LC(Y* X) { return static_castLINK*(X); } templateclass Y static const LINK* LCC(Y* X) { return static_castconst LINK*(X); } -- http://gcc.gnu.org/bugzilla

[Bug c++/36149] -O2 optimization generates wrong code

2008-05-06 Thread dino at concisoft dot com
--- 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: templateclass Y static const LINK* LCC(Y* X) { return static_castconst LINK*(X); } could be missing a const

[Bug c++/36149] -O2 optimization generates wrong code

2008-05-06 Thread dino at concisoft dot com
--- 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. -- http