[Bug c++/15837] Optimization (of templatized functions?)

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Jun 6 04:49:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-06 04:49 -------
No what I am saying is that your code does things which are "undefined" by the C++ standard so the 
compiler is able to do anything (including erasing your hard drive, no gcc will not produce code to do 
that though).  Casting to a different type and then accessing the data inside is declared as undefined 
(there are a few exceptions to that rule, like you access the data via a char pointer and there is no 
aliasing problems, you can cast to a type which adds const or violate and there is no aliasing problems 
but casting between different pointer types and then accessing the data for both of the type is 
undefined).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15837



More information about the Gcc-bugs mailing list