Aliasing fun
Daniel Berlin
dan@dberlin.org
Fri Jan 25 08:39:00 GMT 2002
Robert,
I think you are confused about my point, and thinking i am
claiming things about the same issue, when in fact, i'm responding to
several different issues raised.
My point about undecidability is that using just the C++ standard, it's
not just that we can be conservative and get it correct, it's quite
possible we'll get the wrong answers for type alias sets, because of
implementation specific details that the C++ standard doesn't define.
Mark wants a semi-formal proof that the ABI details provide us enough to
get it right all the time, before we try to do it for all cases. Which i
have no problem with, in reality, but it's not what is being suggested
here.
Right now, we do nothing for structs and classes in C++ (or any aggregate
type for that matter), regardless of any factors.
I want to just do better than what we have now, and both the other Dan and
I think (or at least, theorize) that without any trouble, we can do it
right all the time for a restricted subset that corresponds to c structs
(Ie no inheritance).
They are two different goals.
I don't think the second requires formal proof of correctness. Mark does.
When the other Dan brought up the suggestion that we restrict
ourselves to a subset, Mark brings up stuff about zero-sized bases and
members, which is somewhat irrelevant, since we're restricting ourselves
to a subset without bases, and we have zero-sized members in C.
Kenner's claim that type based aliasing somehow avoids the
undecidability issue is simply wrong, but a separate issue.
But it appears, that in the discussion and responses, the entire
original suggestion the other Dan made has been lost.
I believe that Dan's suggestion would work, and that unless someone knows
of a good reason otherwise, that we can safely apply our existing c type
based alias analysis to structs and classes with no inheritance at
all (and whatever other small caveat or two might be necessary, if any).
Proving this, would entail reproving type based alias analysis for C
structs works on C structs, since the suggestion is specifically to only
handle those class/struct types which are analagous to c structs.
This is also something i would rather not do formally.
So if the answer is that this must be semi-formally or formally, then i'm
just going to leave things be, rather than try to improve them (it's not a
threat, of course, i simply don't have time to sit down and work out a
proof). If our testsuite doesen't adequately test this, then so be it.
Hopefully we are all on the same page now.
--Dan
More information about the Gcc
mailing list