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: [PATCH, PR71602, 4/4] Make canonical_va_list_type more strict


On 19/09/16 13:02, Szabolcs Nagy wrote:
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  <tom@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).


Yes, that's a known issue: PR77558 - [6/7 regression] c-c++-common/va-arg-va-list-type.c fails for arm/aarch64.

Thanks,
- Tom

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77558


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