aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-10-09 15:06:50 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-10-09 15:06:50 +0000
commit4b9e1bc78110d65377acdf23ee3733f8c69baef9 (patch)
tree63fbf5a293c7b24c26396ba37f45eae1f2b6c734 /gcc/ada/gcc-interface/trans.c
parent005f870e9145c83cba08cab71ed9c0de5bb08e2c (diff)
downloadgcc-4b9e1bc78110d65377acdf23ee3733f8c69baef9.zip
gcc-4b9e1bc78110d65377acdf23ee3733f8c69baef9.tar.gz
gcc-4b9e1bc78110d65377acdf23ee3733f8c69baef9.tar.bz2
[Ada] Fix incorrect computation of Component_Size in ASIS mode
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: If this is not a definition, retrieve the expression in all cases even if we are just annotating types. * gcc-interface/trans.c (gnat_to_gnu): Also translate Size attribute for constrained types in this mode. From-SVN: r264983
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r--gcc/ada/gcc-interface/trans.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 53513e5..6757c2f 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -5930,8 +5930,9 @@ gnat_to_gnu (Node_Id gnat_node)
|| kind == N_Type_Conversion)
&& Is_Integer_Type (Etype (gnat_node)))
&& !(kind == N_Attribute_Reference
- && Get_Attribute_Id (Attribute_Name (gnat_node)) == Attr_Length
- && Ekind (Etype (Prefix (gnat_node))) == E_Array_Subtype
+ && (Get_Attribute_Id (Attribute_Name (gnat_node)) == Attr_Length
+ || Get_Attribute_Id (Attribute_Name (gnat_node)) == Attr_Size)
+ && Is_Constrained (Etype (Prefix (gnat_node)))
&& !Is_Constr_Subt_For_U_Nominal (Etype (Prefix (gnat_node))))
&& kind != N_Expanded_Name
&& kind != N_Identifier