aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-02-23 23:37:50 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2021-05-07 05:29:26 -0400
commita4613d9ada54c334650d93edbb4c08069550099e (patch)
tree92b8fbb42ca8bf469ff25dff8465fa3a41a7afa3 /gcc/ada/sem_ch3.adb
parent104f58db5f9cf759e9a223d5a3415d3a71849d79 (diff)
downloadgcc-a4613d9ada54c334650d93edbb4c08069550099e.zip
gcc-a4613d9ada54c334650d93edbb4c08069550099e.tar.gz
gcc-a4613d9ada54c334650d93edbb4c08069550099e.tar.bz2
[Ada] Robust detection of access-to-subprogram and access-to-object types
gcc/ada/ * einfo-utils.adb (Is_Access_Object_Type): Use Directly_Designated_Type. (Is_Access_Subprogram_Type): Use Directly_Designated_Type. (Set_Convention): Use plain Ekind. * gen_il-gen-gen_entities.adb (Type_Kind): Use plain Ekind. * sem_ch3.adb (Access_Type_Declaration): When seeing an illegal completion with an access type don't attempt to decorate the completion entity; previously the entity had its Ekind set to E_General_Access_Type or E_Access_Type, but its Designated_Type was empty, which caused a crash in freezing. (Actually, the error recovery in the surrounding context is still incomplete, e.g. we will crash when the illegal completion is an access to an unknown identifier).
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 5d97f1d..8306309 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -1354,6 +1354,7 @@ package body Sem_Ch3 is
else
pragma Assert (Error_Posted (T));
+ return;
end if;
-- If the designated type is a limited view, we cannot tell if
@@ -6725,7 +6726,9 @@ package body Sem_Ch3 is
Has_Private_Component (Derived_Type));
Conditional_Delay (Derived_Type, Subt);
- if Is_Access_Subprogram_Type (Derived_Type) then
+ if Is_Access_Subprogram_Type (Derived_Type)
+ and then Is_Base_Type (Derived_Type)
+ then
Set_Can_Use_Internal_Rep
(Derived_Type, Can_Use_Internal_Rep (Parent_Type));
end if;