public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-355] [Ada] Plug loophole in Possible_Type_For_Conditional_Expression
@ 2022-05-12 12:40 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-12 12:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9da379f1c220740c236ccfe223af5b435fe72284

commit r13-355-g9da379f1c220740c236ccfe223af5b435fe72284
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Wed Feb 9 17:16:09 2022 +0100

    [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:
---
 gcc/ada/sem_ch4.adb | 4 ++++
 1 file changed, 4 insertions(+)

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-12 12:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 12:40 [gcc r13-355] [Ada] Plug loophole in Possible_Type_For_Conditional_Expression Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).