aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-02-09 17:16:09 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-12 12:38:36 +0000
commit9da379f1c220740c236ccfe223af5b435fe72284 (patch)
tree4ce3a8e74d4ccd34afdd0b7f7a21d11a8b523178 /gcc
parentbcbf83ec10e2ef19d01372ce21fefb3deb3ee8e6 (diff)
downloadgcc-9da379f1c220740c236ccfe223af5b435fe72284.zip
gcc-9da379f1c220740c236ccfe223af5b435fe72284.tar.gz
gcc-9da379f1c220740c236ccfe223af5b435fe72284.tar.bz2
[Ada] Plug loophole in Possible_Type_For_Conditional_Expression
We need to check that the designated subprograms of access-to-subprogram types are subtype conformant before registering a common interpretation. gcc/ada/ * sem_ch4.adb (Possible_Type_For_Conditional_Expression): Add test for subtype conformance in the cases of access-to-subprogram types.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch4.adb4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index d9cd78b..5987b79 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -7904,11 +7904,15 @@ package body Sem_Ch4 is
elsif Is_Access_Subprogram_Attribute (T1)
and then Is_Access_Subprogram_Attribute (T2)
+ and then
+ Subtype_Conformant (Designated_Type (T1), Designated_Type (T2))
then
return T1;
elsif Is_Access_Protected_Subprogram_Attribute (T1)
and then Is_Access_Protected_Subprogram_Attribute (T2)
+ and then
+ Subtype_Conformant (Designated_Type (T1), Designated_Type (T2))
then
return T1;