g++ and aliasing bools

Joe Buck jbuck@synopsys.COM
Fri Jan 25 16:04:00 GMT 2002


> Mark Mitchell wrote:-
> 
> > OK, I like this argument.  *I* find it convincing, at least. :-)
> 
> [...]
> 
> > So, after the branch, let's have a patch to do this.
> 
> Great; I think that Joe's "proof" should go in as a comment; both to
> explain the ideas and subtleties behind the code, but also so we can
> point at it and extract a similar argument from anyone who wants to
> tighten the logic in future.

The argument can be extended to handle non-virtual single or multiple
inheritance: from the C point of view,

struct D : public A, public B {
	int m;
};

can be thought of as

struct D {
	struct A __base1;
	struct B __base2;
	int m;
};

and analyzed in the same way, meaning that D's alias set contains A, B,
and m.  But implementation-wise, that would mean that c_get_alias_set
would have to be told to treat base classes as members.







More information about the Gcc mailing list