diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2012-07-19 21:09:53 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2012-07-19 21:09:53 +0000 |
commit | b42ff0a550777b45ca004460ef55f50f8f0e34c9 (patch) | |
tree | 3ec3b22635fcddef0db081536f221cd82c4dd6f0 /gcc/ada/gcc-interface/decl.c | |
parent | f9fef34989a9d1974943ec3e835a547b56150c6a (diff) | |
download | gcc-b42ff0a550777b45ca004460ef55f50f8f0e34c9.zip gcc-b42ff0a550777b45ca004460ef55f50f8f0e34c9.tar.gz gcc-b42ff0a550777b45ca004460ef55f50f8f0e34c9.tar.bz2 |
decl.c (gnat_to_gnu_entity): Try to ensure that an object of CW type initialized to a value is sufficiently...
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Try to ensure
that an object of CW type initialized to a value is sufficiently
aligned for this value.
From-SVN: r189682
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 2aa20e7..9c44329 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -895,6 +895,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) debug_info_p); } + /* ??? If this is an object of CW type initialized to a value, try to + ensure that the object is sufficient aligned for this value, but + without pessimizing the allocation. This is a kludge necessary + because we don't support dynamic alignment. */ + if (align == 0 + && Ekind (Etype (gnat_entity)) == E_Class_Wide_Subtype + && No (Renamed_Object (gnat_entity)) + && No (Address_Clause (gnat_entity))) + align = get_target_system_allocator_alignment () * BITS_PER_UNIT; + #ifdef MINIMUM_ATOMIC_ALIGNMENT /* If the size is a constant and no alignment is specified, force the alignment to be the minimum valid atomic alignment. The @@ -904,7 +914,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) necessary and can interfere with constant replacement. Finally, do not do it for Out parameters since that creates an size inconsistency with In parameters. */ - if (align == 0 && MINIMUM_ATOMIC_ALIGNMENT > TYPE_ALIGN (gnu_type) + if (align == 0 + && MINIMUM_ATOMIC_ALIGNMENT > TYPE_ALIGN (gnu_type) && !FLOAT_TYPE_P (gnu_type) && !const_flag && No (Renamed_Object (gnat_entity)) && !imported_p && No (Address_Clause (gnat_entity)) |