From 4bdc2738ce61b5f380930f670709ed9e9cd7cf2a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 27 Apr 2018 14:32:09 +0000 Subject: [PATCH] Fix aarch64 ILP32 ICE with vaarg gimplified code 2018-04-27 Richard Biener * config/aarch64/aarch64.c: Simplify ap.__stack advance and fix for ILP32. From-SVN: r259711 --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64.c | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ed17c1cdcb..4db67b8d069 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-27 Richard Biener + + * config/aarch64/aarch64.c: Simplify ap.__stack advance and + fix for ILP32. + 2018-04-27 Richard Biener * tree-cfg.c (verify_expr): Make dead code hit gcc_unreachable. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 4b5183b602b..8aad9f74d7a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -12267,23 +12267,17 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, if (align > 8) { /* if (alignof(type) > 8) (arg = arg + 15) & -16; */ - t = fold_convert (intDI_type_node, arg); - t = build2 (PLUS_EXPR, TREE_TYPE (t), t, - build_int_cst (TREE_TYPE (t), 15)); + t = fold_build_pointer_plus_hwi (arg, 15); t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_cst (TREE_TYPE (t), -16)); - t = fold_convert (TREE_TYPE (arg), t); roundup = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, t); } 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) -- 2.30.2