From: Ghjuvan Lacambre Date: Fri, 28 Feb 2020 13:56:31 +0000 (+0100) Subject: [Ada] Fix wrong type being used for range check generation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10212bd8f06e0f8577e15883cae6f9b7c5f381d8;p=gcc.git [Ada] Fix wrong type being used for range check generation 2020-06-09 Ghjuvan Lacambre gcc/ada/ * sem_res.adb (Resolve_Qualified_Expression): Use Subtype_Mark type. --- diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 6e26ffb3c45..15d08fee4fc 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -10004,8 +10004,10 @@ package body Sem_Res is -- check may convert an illegal static expression and result in warning -- rather than giving an error (e.g Integer'(Integer'Last + 1)). - if Nkind (N) = N_Qualified_Expression and then Is_Scalar_Type (Typ) then - Apply_Scalar_Range_Check (Expr, Typ); + if Nkind (N) = N_Qualified_Expression + and then Is_Scalar_Type (Target_Typ) + then + Apply_Scalar_Range_Check (Expr, Target_Typ); end if; -- AI12-0100: Once the qualified expression is resolved, check whether