Florian Weimer <fwei...@redhat.com> a écrit:

> On 10/10/2012 06:02 PM, Dodji Seketeli wrote:
>
>> I just have one question for own education.
>>
>> Regarding:
>>
>> @@ -2450,7 +2450,13 @@
>>        if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type))
>>          size = size_binop (PLUS_EXPR, size, cookie_size);
>>        else
>> -        cookie_size = NULL_TREE;
>> +        {
>> +          cookie_size = NULL_TREE;
>> +          /* No size arithmetic necessary, so the size check is
>> +             not needed. */
>> +          if (outer_nelts_check != NULL && inner_size == double_int_one)
>> +            outer_nelts_check = NULL_TREE;
>> +        }
>>
>> I couldn't find where in code is TYPE_VEC_NEW_USES_COOKIE is set.  Is it
>> still used?
>
> It's set in gcc/cp/class.c:
>
>    5191   /* Figure out whether or not we will need a cookie when
> dynamically
>    5192      allocating an array of this type.  */
>    5193   TYPE_LANG_SPECIFIC (t)->u.c.vec_new_uses_cookie
>    5194     = type_requires_array_cookie (t);

Ah, I see.  So maybe that statement should be trivially replaced by:

    TYPE_VEC_NEW_USES_COOKIE (t) = type_requires_array_cookie (t);

for better maintainability?

> I'm not sure if we've got proper test coverage for the concrete cookie
> value, but the test case I've included implicitly check if there's a
> cookie if there's a non-trivial destructor.

I see, Thanks.

-- 
                Dodji

Reply via email to