Seen by  Christophe Lyon, verified with a cross that this fixes the
issue.

aarch64 people, can you please test & commit this?

Thanks,
Richard.

2018-04-26  Richard Biener  <rguent...@suse.de>

        * config/aarch64/aarch64.c: Simplify ap.__stack advance and
        fix for ILP32.

Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c        (revision 259669)
+++ gcc/config/aarch64/aarch64.c        (working copy)
@@ -12278,12 +12278,9 @@ aarch64_gimplify_va_arg_expr (tree valis
   else
     roundup = NULL;
   /* Advance ap.__stack  */
-  t = fold_convert (intDI_type_node, arg);
-  t = build2 (PLUS_EXPR, TREE_TYPE (t), t,
-             build_int_cst (TREE_TYPE (t), size + 7));
+  t = fold_build_pointer_plus_hwi (arg, size + 7);
   t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t,
              build_int_cst (TREE_TYPE (t), -8));
-  t = fold_convert (TREE_TYPE (arg), t);
   t = build2 (MODIFY_EXPR, TREE_TYPE (stack), unshare_expr (stack), t);
   /* String up roundup and advance.  */
   if (roundup)

Reply via email to