aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2020-12-22 09:58:43 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-03 05:28:22 -0400
commit5b48ea9dacdae9edae491d72b5db8864109a48a1 (patch)
tree757777aa770ef249befef167eea4d1c9ef0db1c3 /gcc
parent6537318f79694a218b1d4816fbe86dc59694abe5 (diff)
downloadgcc-5b48ea9dacdae9edae491d72b5db8864109a48a1.zip
gcc-5b48ea9dacdae9edae491d72b5db8864109a48a1.tar.gz
gcc-5b48ea9dacdae9edae491d72b5db8864109a48a1.tar.bz2
[Ada] Spurious accessibility error on call in return statement
gcc/ada/ * sem_util.adb (In_Return_Value): Modified to detect when implicit dereference is specified on the return type of a function call within the expression being checked.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_util.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index c4fe191..7b24a40 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -14329,6 +14329,17 @@ package body Sem_Util is
when N_Function_Call =>
if not In_Function_Call then
In_Function_Call := True;
+
+ -- When the function return type has implicit dereference
+ -- specified we know it cannot directly contribute to the
+ -- return value.
+
+ if Present (Etype (Par))
+ and then Has_Implicit_Dereference
+ (Get_Full_View (Etype (Par)))
+ then
+ return False;
+ end if;
else
return False;
end if;