On 29/08/16 17:12, Tom de Vries wrote:
> On 29/08/16 17:51, Joseph Myers wrote:
>> On Wed, 24 Aug 2016, Tom de Vries wrote:
>>
>>> This patch fixes PR71602 by making canonical_va_list_type more strict.

> 2016-08-22  Tom de Vries  <t...@codesourcery.com>
> 
>       PR C/71602
>       * builtins.c (std_canonical_va_list_type): Strictly return non-null for
>       va_list type only.

this does not seem to be true.

> diff --git a/gcc/builtins.c b/gcc/builtins.c
> index abc934b..101b1e3 100644
> --- a/gcc/builtins.c
> +++ b/gcc/builtins.c
> @@ -4089,10 +4089,6 @@ std_canonical_va_list_type (tree type)
>  {
>    tree wtype, htype;
>  
> -  if (INDIRECT_REF_P (type))
> -    type = TREE_TYPE (type);
> -  else if (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE (type)))
> -    type = TREE_TYPE (type);
>    wtype = va_list_type_node;
>    htype = type;
>    /* Treat structure va_list types.  */

here the code follows as

    if (TREE_CODE (wtype) == RECORD_TYPE && POINTER_TYPE_P (htype))
      htype = TREE_TYPE (htype);
    else if (TREE_CODE (wtype) == ARRAY_TYPE)
      [...]
    if (TYPE_MAIN_VARIANT (wtype) == TYPE_MAIN_VARIANT (htype))
      return va_list_type_node;

    return NULL_TREE;

i think va_list* is accepted as va_list in the
first check if it is a struct type.

i think this check is not needed and causes
problems on arm and aarch64 (where va_list is
a struct type).

Reply via email to