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: "Daniel Berlin" <dberlin at dberlin dot org>
- To: "Mark Mitchell" <mark at codesourcery dot com>
- Cc: "Paolo Bonzini" <bonzini at gnu dot org>, "Kenneth Zadeck" <zadeck at naturalbridge dot com>, "David Edelsohn" <dje at watson dot ibm 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>, olga at il dot ibm dot com
- Date: Tue, 29 Jul 2008 20:51:12 -0400
- 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> <488F006A.5040008@naturalbridge.com> <488F2CF7.1090002@codesourcery.com> <488F3534.3050606@gnu.org> <4aca3dc20807291735h62febc1m3afbc99f50c4da5@mail.gmail.com> <488FB990.9010603@codesourcery.com>
On Tue, Jul 29, 2008 at 8:45 PM, Mark Mitchell <mark@codesourcery.com> wrote:
> Daniel Berlin wrote:
>
>> If you built an AST that included sizeof before doing template
>> instantiation (which may not even be possible), you could at least
>> determine whether sizeof was used on a given type other than in a
>> malloc/new call (which we replace anyway).
>
> Even if you did, I am allowed to know the ABI.
>
> I can know that struct S has size 12 on this ABI, and do things like:
>
> struct S a[3];
> struct S* p = &a[0];
> /* This points at a[1]. */
> struct S* q = ((char *)p) + 12;
Sure, but anything that reorgs the structure has to be able to handle
this anyway, and already does (in our case, it disallows reorg if you
do things like this).
The problem that sizeof creates is different, in that you have no way
to tell where it's been used.
>
> So, these kinds of optimizations, where you rip fields out of a structure
> are only safe if you can prove that addresses don't escape -- or if the user
> explicitly tells you that they are.
>
> --
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713
>