On Thu, Nov 26, 2015 at 7:32 AM, Jan Hubicka <hubi...@ucw.cz> wrote:
> Hi,
> what aout this?
>
> Index: tree.c
> ===================================================================
> --- tree.c      (revision 230924)
> +++ tree.c      (working copy)
> @@ -13424,6 +13424,12 @@ gimple_canonical_types_compatible_p (con
>        {
>         tree f1, f2;
>
> +       /* Don't try to compare variants of an incomplete type, before
> +          TYPE_FIELDS has been copied around.  */
> +       if (!COMPLETE_TYPE_P (t1) && !COMPLETE_TYPE_P (t2))
> +         return true;
> +

As said, you shouldn't call this function on variants.  It wasn't
designed for that.  Please do the above
check where necessary in the caller (the verifier).

Overloading this for verification and canonical type compute now bites back...

RIchard.

>         if (TYPE_REVERSE_STORAGE_ORDER (t1) != TYPE_REVERSE_STORAGE_ORDER 
> (t2))
>           return false;
>
> @@ -13710,28 +13716,35 @@ verify_type (const_tree t)
>         }
>      }
>    else if (RECORD_OR_UNION_TYPE_P (t))
> -    for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld))
> -      {
> -       /* TODO: verify properties of decls.  */
> -       if (TREE_CODE (fld) == FIELD_DECL)
> -         ;
> -       else if (TREE_CODE (fld) == TYPE_DECL)
> -         ;
> -       else if (TREE_CODE (fld) == CONST_DECL)
> -         ;
> -       else if (TREE_CODE (fld) == VAR_DECL)
> -         ;
> -       else if (TREE_CODE (fld) == TEMPLATE_DECL)
> -         ;
> -       else if (TREE_CODE (fld) == USING_DECL)
> -         ;
> -       else
> -         {
> -           error ("Wrong tree in TYPE_FIELDS list");
> -           debug_tree (fld);
> -           error_found = true;
> -         }
> -      }
> +    {
> +      if (TYPE_FIELDS (t) && !COMPLETE_TYPE_P (t) && in_lto_p)
> +       {
> +         error ("TYPE_FIELDS defined in incomplete type");
> +         error_found = true;
> +       }
> +      for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld))
> +       {
> +         /* TODO: verify properties of decls.  */
> +         if (TREE_CODE (fld) == FIELD_DECL)
> +           ;
> +         else if (TREE_CODE (fld) == TYPE_DECL)
> +           ;
> +         else if (TREE_CODE (fld) == CONST_DECL)
> +           ;
> +         else if (TREE_CODE (fld) == VAR_DECL)
> +           ;
> +         else if (TREE_CODE (fld) == TEMPLATE_DECL)
> +           ;
> +         else if (TREE_CODE (fld) == USING_DECL)
> +           ;
> +         else
> +           {
> +             error ("Wrong tree in TYPE_FIELDS list");
> +             debug_tree (fld);
> +             error_found = true;
> +           }
> +       }
> +    }
>    else if (TREE_CODE (t) == INTEGER_TYPE
>            || TREE_CODE (t) == BOOLEAN_TYPE
>            || TREE_CODE (t) == OFFSET_TYPE

Reply via email to