This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: lto gimple types and debug info
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>, David Edelsohn <dje at watson dot ibm dot com>, Kenneth Zadeck <zadeck at naturalbridge dot com>, GCC Development <gcc at gcc dot gnu dot org>, Diego Novillo <dnovillo at google dot com>, "Hubicha, Jan" <jh at suse dot cz>, Richard Guenther <richard dot guenther at gmail dot com>, "Taylor, Ian Lance" <iant at google dot com>, Ollie Wild <aaw at google dot com>, "Maddox, Bill" <maddox at google dot com>, jason at redhat dot com, Rafael Espindola <espindola at google dot com>
- Date: Tue, 29 Jul 2008 11:59:16 +0000 (UTC)
- Subject: Re: lto gimple types and debug info
- References: <488A6E70.2060708@codesourcery.com> <200807261748.m6QHmh0O027966@makai.watson.ibm.com> <488CADFB.4020007@codesourcery.com> <488EB8C5.3090308@gnu.org>
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