From 57f4f0d5f662eec0aa38ac0f554262ce072a8eeb Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 8 Feb 2015 10:12:38 +0000 Subject: decl.c (gnat_to_gnu_param): Do not strip the padding if the parameter either is passed by reference or if... * gcc-interface/decl.c (gnat_to_gnu_param): Do not strip the padding if the parameter either is passed by reference or if the alignment would be lowered. From-SVN: r220514 --- gcc/ada/gcc-interface/decl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gcc/ada/gcc-interface/decl.c') diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index c7d64aa..94043b6 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5659,15 +5659,17 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, } /* If this is either a foreign function or if the underlying type won't - be passed by reference, strip off possible padding type. */ + be passed by reference and is as aligned as the original type, strip + off possible padding type. */ if (TYPE_IS_PADDING_P (gnu_param_type)) { tree unpadded_type = TREE_TYPE (TYPE_FIELDS (gnu_param_type)); - if (mech == By_Reference - || foreign + if (foreign || (!must_pass_by_ref (unpadded_type) - && (mech == By_Copy || !default_pass_by_ref (unpadded_type)))) + && mech != By_Reference + && (mech == By_Copy || !default_pass_by_ref (unpadded_type)) + && TYPE_ALIGN (unpadded_type) >= TYPE_ALIGN (gnu_param_type))) gnu_param_type = unpadded_type; } -- cgit v1.1