From: Eric Botcazou Date: Wed, 9 Feb 2022 16:16:09 +0000 (+0100) Subject: [Ada] Plug loophole in Possible_Type_For_Conditional_Expression X-Git-Tag: basepoints/gcc-14~6852 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9da379f1c220740c236ccfe223af5b435fe72284;p=thirdparty%2Fgcc.git [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. --- diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index d9cd78b6bae..5987b796ae2 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;