g++ and aliasing bools

Daniel Berlin dan@dberlin.org
Fri Jan 25 09:21:00 GMT 2002


On Fri, 25 Jan 2002, Robert Dewar wrote:

> <<However, the important point is that the language semantics don't allow
> us to get it *right*, not just deciding. We may get it *wrong*, and think
> we have it *right*.
> >>
> 
> Then you have misread the language specs, or GCC is wrong, no other
> possibilities exist!
Incorrect on all three points.
First, The devil is in the implementation specific portions that are part 
of the 
C++ ABI spec, and tell you what the layout of vtables, etc, is. This is 
what one needs, in addition to the language spec, to be able to tell 
aliasing properly.
At least, this is what is thought, anyway, it still might not be enough.
The language spec by itself, however, is *not* enough, and just using the 
rules in it will ignore the whole problem of shared vtables, and given you 
wrong answers *because* implementations do share pieces of classes.
Second, GCC is right  because it just says that in C++, all aggregate type 
can alias anything, avoiding the probblem altogether
Third, the above is a third dpossibility, which not only exists, but is 
the current situation.


> 



More information about the Gcc mailing list