From aae8570a44715ff724f31c3fc2442e5f69c929a7 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 23 May 2009 10:37:34 +0000 Subject: decl.c (gnat_to_gnu_entity): Do not modify the original type because of the alignment when... * gcc-interface/decl.c (gnat_to_gnu_entity) : Do not modify the original type because of the alignment when there is an address clause. From-SVN: r147818 --- gcc/ada/gcc-interface/decl.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gcc/ada/gcc-interface') diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 649b9ef..ca48c5a 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -608,17 +608,22 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) return error_mark_node; } - /* If an alignment is specified, use it if valid. Note that - exceptions are objects but don't have alignments. We must do this - before we validate the size, since the alignment can affect the - size. */ + /* If an alignment is specified, use it if valid. Note that exceptions + are objects but don't have an alignment. We must do this before we + validate the size, since the alignment can affect the size. */ if (kind != E_Exception && Known_Alignment (gnat_entity)) { gcc_assert (Present (Alignment (gnat_entity))); align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); - gnu_type = maybe_pad_type (gnu_type, NULL_TREE, align, gnat_entity, - "PAD", false, definition, true); + /* No point in changing the type if there is an address clause + as the final type of the object will be a reference type. */ + if (Present (Address_Clause (gnat_entity))) + align = 0; + else + gnu_type + = maybe_pad_type (gnu_type, NULL_TREE, align, gnat_entity, + "PAD", false, definition, true); } /* If we are defining the object, see if it has a Size value and -- cgit v1.1