This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/19637] Missed VRP and FRE opportunities in the presence of casts



------- 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]