From 326c36ce378edd0d965bb6dfd3d98a90668fff30 Mon Sep 17 00:00:00 2001 From: Yannick Moy Date: Tue, 15 Sep 2020 15:28:51 +0200 Subject: [PATCH] [Ada] Fix GNATprove crash on generics with access types gcc/ada/ * sem_ch12.adb (Restore_Private_Views): Do not lose the information provided by Is_Generic_Actual_Type in GNATprove mode. --- gcc/ada/sem_ch12.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 6937153c537..af77263388c 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -15389,13 +15389,21 @@ package body Sem_Ch12 is if Is_Type (E) and then Nkind (Parent (E)) = N_Subtype_Declaration then + -- Always preserve the flag Is_Generic_Actual_Type for GNATprove, + -- as it is needed to identify the subtype with the type it + -- renames, when there are conversions between access types + -- to these. + + if GNATprove_Mode then + null; + -- If the actual for E is itself a generic actual type from -- an enclosing instance, E is still a generic actual type -- outside of the current instance. This matter when resolving -- an overloaded call that may be ambiguous in the enclosing -- instance, when two of its actuals coincide. - if Is_Entity_Name (Subtype_Indication (Parent (E))) + elsif Is_Entity_Name (Subtype_Indication (Parent (E))) and then Is_Generic_Actual_Type (Entity (Subtype_Indication (Parent (E)))) then -- 2.30.2