This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: lto gimple types and debug info


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]