[RFC PATCH] Add alloc_size attribute to the default operator new and operator new[]

Richard Guenther richard.guenther@gmail.com
Thu Aug 4 13:54:00 GMT 2011


On Thu, Aug 4, 2011 at 3:50 PM, Gabriel Dos Reis
<gdr@integrable-solutions.net> wrote:
> On Thu, Aug 4, 2011 at 8:43 AM, Jason Merrill <jason@redhat.com> wrote:
>> On 08/04/2011 08:58 AM, Gabriel Dos Reis wrote:
>>>
>>> Do you intend to rule out garbage collectors?
>>
>> No, I suppose the rule should be that interleaved access through the
>> returned pointer and other ways is undefined.
>
> OK.
>
>>> Should not access as raw memory (e.g. through char* or void*) be allowed?
>>
>> No, accessing it as raw memory is no different.
>
> Hmm, maybe I misunderstand what you are saying.  But, I think a
> scanning collector
> should be allowed.

But not interleaved with allocator users.  Problems will only arise if
you mix code using storage via the pointer returned from the allocator
and code that accesses the allocation pool by other means.
Where "mix" is, expose in one TU (actually expose partially, full
exposure is ok as well).

Richard.

> -- Gaby
>



More information about the Gcc-patches mailing list