This is the mail archive of the gcc-patches@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: [trunk<-vta] Re: [vta, 4.4] make df-scan df_collection_rec arrays overflow-safe


Ian Lance Taylor wrote:
> Richard Guenther <richard.guenther@gmail.com> writes:
> 
>> On Mon, Jun 1, 2009 at 6:39 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>> Does anybody think that would be a bad idea?
>>> No, on the contrary it is a good idea.
>> Can we have compile-time checking that you not let such VEC
>> escape somehow?
> 
> The ways that I can see that it could escape would be 1) declare a
> global variable as VEC(type,alloca); 2) assign a pointer to a
> VEC(type,alloca) to a global variable; 3) Return a pointer to a
> VEC(type,alloca) declared in the same function.  Case 2 would actually
> be OK as long as you didn't use the global variable after the original
> function returned.  I don't see how to warn about these without
> introducing an additional type attribute.  Heck, we don't even warn
> about "return alloca (10);".

  Could GTY be hacked to scream if it comes across a pointer to a VEC that
shouldn't have escaped?  Maybe as a --enable-checking feature?

    cheers,
      DaveK


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