From: Eric Botcazou Date: Thu, 19 Mar 2020 10:41:37 +0000 (+0100) Subject: [Ada] Fix assertion failure on entry call through unchecked conversion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=12ad5b9ccc77adabf81ba798217ac4cdace8ba1f;p=gcc.git [Ada] Fix assertion failure on entry call through unchecked conversion 2020-06-11 Eric Botcazou gcc/ada/ * exp_util.adb (Safe_Unchecked_Type_Conversion): Add missing Is_Type guard before calling Has_Discriminants on Etype. --- diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 5e186ec1ca4..471790e73ee 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -12551,13 +12551,10 @@ package body Exp_Util is elsif Nkind (Pexp) = N_Selected_Component and then Prefix (Pexp) = Exp then - if No (Etype (Pexp)) then - return True; - else - return - not Has_Discriminants (Etype (Pexp)) - or else Is_Constrained (Etype (Pexp)); - end if; + return No (Etype (Pexp)) + or else not Is_Type (Etype (Pexp)) + or else not Has_Discriminants (Etype (Pexp)) + or else Is_Constrained (Etype (Pexp)); end if; -- Set the output type, this comes from Etype if it is set, otherwise we