From: Steve Baird Date: Fri, 13 Dec 2019 09:04:48 +0000 (+0000) Subject: [Ada] Detect illegal implicit type conversions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a85475beae62f908312ddb233d79cf1df60216e5;p=gcc.git [Ada] Detect illegal implicit type conversions 2019-12-13 Steve Baird gcc/ada/ * sem_res.adb (Resolve, Valid_Conversion): Add Base_Type call when testing whether a type is a general access type. From-SVN: r279357 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dde5372e80f..c920c2c3e1e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-12-13 Steve Baird + + * sem_res.adb (Resolve, Valid_Conversion): Add Base_Type call + when testing whether a type is a general access type. + 2019-12-13 Javier Miranda * exp_ch4.adb (Expand_N_Unchecked_Type_Conversion): Generate an diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 3568a890186..54d47286605 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3256,7 +3256,7 @@ package body Sem_Res is -- convert implicitly are allowed in membership tests). if Ada_Version >= Ada_2012 - and then Ekind (Ctx_Type) = E_General_Access_Type + and then Ekind (Base_Type (Ctx_Type)) = E_General_Access_Type and then Ekind (Etype (N)) = E_Anonymous_Access_Type and then Nkind (Parent (N)) not in N_Membership_Test then @@ -13328,7 +13328,7 @@ package body Sem_Res is if Ada_Version >= Ada_2012 and then not Comes_From_Source (N) and then Is_Rewrite_Substitution (N) - and then Ekind (Target_Type) = E_General_Access_Type + and then Ekind (Base_Type (Target_Type)) = E_General_Access_Type and then Ekind (Opnd_Type) = E_Anonymous_Access_Type then if Is_Itype (Opnd_Type) then