From: Arnaud Charlet Date: Tue, 17 Jul 2018 08:12:51 +0000 (+0000) Subject: [Ada] Preserve original CE reason in more cases X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b4f211d2a7f41f147413d0b756ffe56aec78230;p=gcc.git [Ada] Preserve original CE reason in more cases 2018-07-17 Arnaud Charlet gcc/ada/ * sem_eval.adb (Rewrite_In_Raise_CE): Keep the original reason in more cases. From-SVN: r262802 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 38db4d6189d..21b7bb897fc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-07-17 Arnaud Charlet + + * sem_eval.adb (Rewrite_In_Raise_CE): Keep the original reason in more + cases. + 2018-07-17 Arnaud Charlet * checks.adb (Apply_Division_Check): Add provision for floating-point diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 2bdf73d72de..51094cd1730 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -5707,9 +5707,16 @@ package body Sem_Eval is -- Else build an explicit N_Raise_CE else - Rewrite (N, - Make_Raise_Constraint_Error (Sloc (Exp), - Reason => CE_Range_Check_Failed)); + if Nkind (Exp) = N_Raise_Constraint_Error then + Rewrite (N, + Make_Raise_Constraint_Error (Sloc (Exp), + Reason => Reason (Exp))); + else + Rewrite (N, + Make_Raise_Constraint_Error (Sloc (Exp), + Reason => CE_Range_Check_Failed)); + end if; + Set_Raises_Constraint_Error (N); Set_Etype (N, Typ); end if;