This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ and aliasing bools
- From: Daniel Berlin <dan at dberlin dot org>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Joe Buck <jbuck at synopsys dot COM>, David Edelsohn <dje at watson dot ibm dot com>, Paolo Carlini <pcarlini at unitus dot it>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 25 Jan 2002 17:19:15 -0500 (EST)
- Subject: Re: g++ and aliasing bools
On Fri, 25 Jan 2002, Mark Mitchell wrote:
> > Let's proceed in another way. I think that, for the purpose of Dan's
> > proof, he should be allowed to accept as a postulate that c_get_alias_set
> > is correct when applied to C. If this postulate is not acceptable,
> > then it seems that if someone owes us a proof, it is Mark, not Daniel.
> > However, c_get_alias_set has been there long enough that we have
> > reasonable confidence in it.
>
> Agreed.
>
> > I think it's also fair to assume as a postulate that the current
> > conservative cxx_get_alias_set is safe. Again, long experience.
>
> Agreed.
>
> > cxx_get_alias_set ()
> > {
> > if (AGGREGATE_TYPE && HAS_BASECLASSES && HAS_VIRTUALS)
> > return 0;
> > return c_get_alias_set();
> > }
> >
>
> > While this is not a formal proof, it's enough to convince me that Daniel's
> > change is safe.
>
> Your proof has at least one bug. A type that has no baseclasses or
> virtuals can contain (as a data member) a type that does; such a type
> is at least as complex as the contained type.
However, that type would have alias set 0 already, because it would have
failed the above test. So any accesses to something inside of it would be
assumed to alias everything else anyway.
--Dan