From 14ecca2eea820447afe3214ed635883fbc4244a4 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 30 Nov 2015 11:25:24 +0000 Subject: ada-tree.h (TYPE_MAX_ALIGN): New macro. * gcc-interface/ada-tree.h (TYPE_MAX_ALIGN): New macro. * gcc-interface/decl.c (gnat_to_gnu_entity): Do not set PACKED to -2. Remove obsolete code setting the alignment on some atomic types. When the type has no alignment but needs strict alignment and has a size clause, compute a maximum alignment and set it on the type. (adjust_packed): Remove handling of -2 argument. Deal with TYPE_ALIGN and TYPE_MAX_ALIGN directly. (gnat_to_gnu_field): Do not document -2 as argument. (components_to_record): Likewise. * gcc-interface/utils.c (finish_record_type): Do not bump alignment of the record type beyond TYPE_MAX_ALIGN. Reset the latter on exit. * gcc-interface/Makefile.in (PICFLAG_FOR_TARGET): Move around. (GNATLIBCFLAGS_FOR_C): Reformat. (GCC_CFLAGS): Delete. From-SVN: r231062 --- gcc/ada/gcc-interface/utils.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/ada/gcc-interface/utils.c') diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 0016a3f..f236907 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -1694,7 +1694,8 @@ finish_record_type (tree record_type, tree field_list, int rep_level, /* The enclosing record type must be sufficiently aligned. Otherwise, if no alignment was specified for it and it has been laid out already, bump its alignment to the - desired one if this is compatible with its size. */ + desired one if this is compatible with its size and + maximum alignment, if any. */ if (TYPE_ALIGN (record_type) >= align) { DECL_ALIGN (field) = MAX (DECL_ALIGN (field), align); @@ -1702,7 +1703,9 @@ finish_record_type (tree record_type, tree field_list, int rep_level, } else if (!had_align && rep_level == 0 - && value_factor_p (TYPE_SIZE (record_type), align)) + && value_factor_p (TYPE_SIZE (record_type), align) + && (!TYPE_MAX_ALIGN (record_type) + || TYPE_MAX_ALIGN (record_type) >= align)) { TYPE_ALIGN (record_type) = align; DECL_ALIGN (field) = MAX (DECL_ALIGN (field), align); @@ -1800,6 +1803,9 @@ finish_record_type (tree record_type, tree field_list, int rep_level, } } + /* Reset the TYPE_MAX_ALIGN field since it's private to gigi. */ + TYPE_MAX_ALIGN (record_type) = 0; + if (debug_info_p) rest_of_record_type_compilation (record_type); } -- cgit v1.1