lto gimple types and debug info
Joseph S. Myers
joseph@codesourcery.com
Tue Jul 29 13:17:00 GMT 2008
On Tue, 29 Jul 2008, 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.
sizeof(X) will have been converted to an integer constant in the front end
long before any structure rearrangement transformations are applied; even
for VLAs sizeof will be lowered at gimplification at the very latest.
Saving memory for malloc would require the compiler to analyse how the
malloced memory is used and deduce that a smaller value could be passed to
malloc.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list