aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/atree.adb
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2021-07-20 13:59:19 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-22 15:01:46 +0000
commit8c61547d80c8b4c611284b63e92d10f87c9898b2 (patch)
treeff4b1fa963e22c44430bf79894eb7dea59a7652d /gcc/ada/atree.adb
parent0b7ddfb9f13b3bfb7f4fc9ac23f6adf4f36e7098 (diff)
downloadgcc-8c61547d80c8b4c611284b63e92d10f87c9898b2.zip
gcc-8c61547d80c8b4c611284b63e92d10f87c9898b2.tar.gz
gcc-8c61547d80c8b4c611284b63e92d10f87c9898b2.tar.bz2
[Ada] Fix infinite loop in compilation of illegal code
gcc/ada/ * atree.adb (Rewrite): Fix parent node of shared aspects. * atree.ads (Rewrite): Add ??? comment on incorrect documentation. * einfo-utils.adb (Known_Esize): Fix logic. * sem_ch13.adb (Alignment_Check_For_Size_Change, Analyze_Attribute_Definition_Clause): Protect against unset Size.
Diffstat (limited to 'gcc/ada/atree.adb')
-rw-r--r--gcc/ada/atree.adb10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 540d4ff..d69d403 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -2025,10 +2025,16 @@ package body Atree is
-- Both the old and new copies of the node will share the same list
-- of aspect specifications if aspect specifications are present.
+ -- Restore the parent link of the aspect list to the old node, which
+ -- is the one linked in the tree.
if Old_Has_Aspects then
- Set_Aspect_Specifications
- (Sav_Node, Aspect_Specifications (Old_Node));
+ declare
+ Aspects : constant List_Id := Aspect_Specifications (Old_Node);
+ begin
+ Set_Aspect_Specifications (Sav_Node, Aspects);
+ Set_Parent (Aspects, Old_Node);
+ end;
end if;
end if;