commit f8bd310d65f2b8fd8d7e1151a4a1f84489738029 Author: Alan Lawrence Date: Wed Jun 3 18:22:36 2015 +0100 arm_needs_doubleword_align: explore one level for aggregates, also arrays. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index e79a369..e12198a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -6151,8 +6151,23 @@ arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype, static bool arm_needs_doubleword_align (machine_mode mode, const_tree type) { - return (GET_MODE_ALIGNMENT (mode) > PARM_BOUNDARY - || (type && TYPE_ALIGN (type) > PARM_BOUNDARY)); + if (!type) + return PARM_BOUNDARY < GET_MODE_ALIGNMENT (mode); + + /* Scalar and vector types: Use natural alignment, i.e. of base type. */ + if (!AGGREGATE_TYPE_P (type)) + return TYPE_ALIGN (TYPE_MAIN_VARIANT (type)) > PARM_BOUNDARY; + + /* Array types: Use member alignment of element type. */ + if (TREE_CODE (type) == ARRAY_TYPE) + return TYPE_ALIGN (TREE_TYPE (type)) > PARM_BOUNDARY; + + /* Record/aggregate types: Use greatest member alignment of any member. */ + for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) + if (DECL_ALIGN (field) > PARM_BOUNDARY) + return true; + + return false; }