Paolo Bonzini wrote:
Mark Mitchell wrote:
For that matter, "print sizeof(X)" should print the same value when
debugging optimized code as when debugging unoptimized code, even if
the compiler has optimized X away to an empty structure!
I disagree. sizeof(X) in the code will return a value as small as
possible in that case (so that malloc-ing an array of structures) does
not waste memory, and the debugger should do the same.
Paolo
I think I agree with paolo here. One of the issues is how throughly
the (current or future) passes rewrites the code. I have never looked
at struct reorg close enough to know if it generates new types and
resets the decls or if it just hacks the old types. It could do either
one.
if it generates new types, then saying sizeof(X) in the debugger could
do what mark wants, it is just that X is not the type of the structure
any more. It is a matter of speculation as to if this is more or less
confusing than hacking the type itself.
The bottom line here is that it is going to be hard to totally hide this
from the user. There are going to be edges that show. The question is
how much do we want to try.
kenny