This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21407] [4.1 Regression] wrong code with upcast in C++
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2005 14:51:08 -0000
- Subject: [Bug tree-optimization/21407] [4.1 Regression] wrong code with upcast in C++
- References: <20050506002331.21407.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-10 14:51 -------
(In reply to comment #4)
> void foo1(void* ptr)
> {
> ((struct A*)ptr)->a = 0;
> }
Because you just violated C aliasing. This is unlike C++ where upcasting is okay.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21407