This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19637] Missed VRP and FRE opportunities in the presence of casts
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jan 2006 10:35:02 -0000
- Subject: [Bug tree-optimization/19637] Missed VRP and FRE opportunities in the presence of casts
- References: <bug-19637-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from rguenth at gcc dot gnu dot org 2006-01-08 10:35 -------
(In reply to comment #9)
> Actually that is still a violation of the aliasing rules, as you are acessing a
> character as a Foo. Yes that is violation, though I think GCC does not define
> it as one.
I think the code is fine - memory is accessed only as Foo (though it is
declared
as char). This simulates
int foo_charchar(void)
{
void *i = alloca(2*sizeof(int));
new (i) Foo();
return reinterpret_cast<Foo*>(i)->i[0];
}
by making the storage explicit.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19637