aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-12-16 16:32:15 +0100
committerMarc Poulhiès <poulhies@adacore.com>2023-01-05 15:30:00 +0100
commit59d1681bf3dec3a5077247a77e4862516b561284 (patch)
tree29c390568ac8f05ffbef2efe1888bffad3a8c85b
parentf0bed52ec97a485aa6ddfd6d83a20402eaf4a63e (diff)
downloadgcc-59d1681bf3dec3a5077247a77e4862516b561284.zip
gcc-59d1681bf3dec3a5077247a77e4862516b561284.tar.gz
gcc-59d1681bf3dec3a5077247a77e4862516b561284.tar.bz2
ada: Further adjust freezing for expansion of contracts
This further adjusts a test deciding whether to freeze an entity coming from an outer scope in an inner scope based on language rules, to the presence of the new internal subprogram generated because of post-conditions. gcc/ada/ * freeze.adb (Freeze_Entity): For the purpose of deciding whether to freeze an entity coming from an outer scope in an inner scope, treat the internal subprogram generated because of post-conditions as also coming from source if the original subprogram itself does.
-rw-r--r--gcc/ada/freeze.adb7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 7f78b43..97a25d1 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -6281,7 +6281,10 @@ package body Freeze is
end if;
-- Otherwise, loop through scopes checking if an enclosing scope
- -- comes from source or is a generic.
+ -- comes from source or is a generic. Note that, for the purpose
+ -- of this test, we need to consider that the internally generated
+ -- subprogram described above comes from source too if the original
+ -- subprogram itself does.
declare
S : Entity_Id;
@@ -6291,6 +6294,8 @@ package body Freeze is
while Present (S) loop
if Is_Overloadable (S) then
if Comes_From_Source (S)
+ or else (Chars (S) = Name_uWrapped_Statements
+ and then Comes_From_Source (Scope (S)))
or else Is_Generic_Instance (S)
or else Is_Child_Unit (S)
then