On November 9, 2018 10:00:08 AM GMT+01:00, Jan Hubicka <hubi...@ucw.cz> wrote:
>Hi,
>this patch fixes handling of TYPE_USER_ALIGN.  I tried to drop it
>completely from LTO streaming and clear it in free lang data but it
>breaks one ubsan testcase:
>
>FAIL: c-c++-common/ubsan/pr63802.c   -O2 -flto -fno-use-linker-plugin
>-flto-partition=none  output pattern test
>FAIL: c-c++-common/ubsan/pr63802.c   -O2 -flto -fuse-linker-plugin
>-fno-fat-lto-objects  output pattern test
>
>lto-bootstrapped/regtested x86_64-linux, OK?

OK. 

Richard. 

>Honza
>
>       * tree.c (fld_type_variant_equal_p): Test user align flag.
>       (flt_type_variant): Copy user align flag.
>       (fld_incomplete_type_of): Clear it.
>Index: tree.c
>===================================================================
>--- tree.c     (revision 265914)
>+++ tree.c     (working copy)
>@@ -5109,7 +5109,8 @@ fld_type_variant_equal_p (tree t, tree v
>       /* We want to match incomplete variants with complete types.
>        In this case we need to ignore alignment.   */
>       || ((!RECORD_OR_UNION_TYPE_P (t) || COMPLETE_TYPE_P (v))
>-        && TYPE_ALIGN (t) != TYPE_ALIGN (v))
>+        && (TYPE_ALIGN (t) != TYPE_ALIGN (v)
>+            || TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (v)))
>       || fld_simplified_type_name (t) != fld_simplified_type_name (v)
>       || !attribute_list_equal (TYPE_ATTRIBUTES (t),
>                               TYPE_ATTRIBUTES (v)))
>@@ -5140,7 +5141,10 @@ fld_type_variant (tree first, tree t, st
>   /* Variants of incomplete types should have alignment 
>      set to BITS_PER_UNIT.  Do not copy the actual alignment.  */
>   if (!RECORD_OR_UNION_TYPE_P (v) || COMPLETE_TYPE_P (v))
>-    SET_TYPE_ALIGN (v, TYPE_ALIGN (t));
>+    {
>+      SET_TYPE_ALIGN (v, TYPE_ALIGN (t));
>+      TYPE_USER_ALIGN (v) = TYPE_USER_ALIGN (t);
>+    }
>   gcc_checking_assert (fld_type_variant_equal_p (t,v));
>   add_tree_to_fld_list (v, fld);
>   return v;
>@@ -5194,6 +5198,7 @@ fld_incomplete_type_of (tree t, struct f
>         TYPE_SIZE (copy) = NULL;
>         SET_TYPE_MODE (copy, VOIDmode);
>         SET_TYPE_ALIGN (copy, BITS_PER_UNIT);
>+        TYPE_USER_ALIGN (copy) = 0;
>         TYPE_SIZE_UNIT (copy) = NULL;
>         TYPE_CANONICAL (copy) = TYPE_CANONICAL (t);
>         TYPE_TYPELESS_STORAGE (copy) = 0;

Reply via email to