This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: Problem with Object Size Checking and reallocarray


On 2018-03-13 07:51, Corinna Vinschen wrote:
> On Mar 12 19:58, Jon Turney wrote:
>> reallocarray() is annotated in stdlib.h with '__alloc_size(2)
>> __alloc_size(3)'
>>
>> per [1], this doesn't seem to be the correct syntax when the size is the
>> product of the arguments, and the last alloc_size seems to be silently
>> winning.
>>
>> If I change this to '__alloc_size((2,3))' (as in the patch attached),
>> __builtin_object_size doesn't seem to be a compile-time constant anymore,
>> and so memcpy() evaluates differently, so it's hard to be sure that's
>> actually correct...
>>
>> [1] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
> 
> Yaakov, care to comment and push if the patch is ok?

Thanks, pushed.

-- 
Yaakov

Attachment: signature.asc
Description: OpenPGP digital signature


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