diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-12-18 14:31:52 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-06 11:11:26 +0200 |
commit | 9bc49f5ac1e1140f00f488f5d05294541079fb1b (patch) | |
tree | af8ef1fd028941df96b77510692a142c7d3eb99e | |
parent | dd548dc587d16ac9d272899739d384e67789e862 (diff) | |
download | gcc-9bc49f5ac1e1140f00f488f5d05294541079fb1b.zip gcc-9bc49f5ac1e1140f00f488f5d05294541079fb1b.tar.gz gcc-9bc49f5ac1e1140f00f488f5d05294541079fb1b.tar.bz2 |
ada: Fix missing associated node for packed array itypes
After decoration, itypes should have its associated node set.
gcc/ada/
* exp_pakd.adb (Create_Packed_Array_Impl_Type): Set associated
node for the packed array itype.
* exp_util.adb (Possible_Side_Effect_In_SPARK): Remove
workaround for a missing associated node.
-rw-r--r-- | gcc/ada/exp_pakd.adb | 4 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 15 |
2 files changed, 6 insertions, 13 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index 628a3e3..3f26c35 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -541,8 +541,12 @@ package body Exp_Pakd is if Is_Itype (Typ) then Set_Parent (Decl, Associated_Node_For_Itype (Typ)); + Set_Associated_Node_For_Itype + (PAT, Associated_Node_For_Itype (Typ)); else Set_Parent (Decl, Declaration_Node (Typ)); + Set_Associated_Node_For_Itype + (PAT, Declaration_Node (Typ)); end if; if Scope (Typ) /= Current_Scope then diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 25190a6..e757327 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -11917,7 +11917,7 @@ package body Exp_Util is -- When this routine is called while the itype -- is being created, the entity might not yet be - -- decorated with the associated node, but should + -- decorated with the associated node, but will -- have the related expression. if Present (Associated_Node_For_Itype (Subt)) then @@ -11925,21 +11925,10 @@ package body Exp_Util is Possible_Side_Effect_In_SPARK (Associated_Node_For_Itype (Subt)); - elsif Present (Related_Expression (Subt)) then + else return Possible_Side_Effect_In_SPARK (Related_Expression (Subt)); - - -- When the itype doesn't have any indication of its - -- origin (which currently only happens for packed - -- array types created by freezing that shouldn't - -- be picked by GNATprove anyway), then we can - -- conservatively assume that the expression can - -- be kept as it appears in the source code. - - else - pragma Assert (Is_Packed_Array_Impl_Type (Subt)); - return False; end if; else return True; |