]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Move messages on division by zero to the right operand
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 7 Dec 2021 15:58:59 +0000 (16:58 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 6 Jan 2022 17:11:40 +0000 (17:11 +0000)
gcc/ada/

* sem_eval.adb (Eval_Arithmetic_Op): Add Loc parameter to all
calls to Apply_Compile_Time_Constraint_Error related to division
by zero.

gcc/ada/sem_eval.adb

index 33303c4015b02db1c62914697609a63ddbddbb17..f85efc2a38ccfa0e212bc831fb71e28294329302 100644 (file)
@@ -2117,6 +2117,7 @@ package body Sem_Eval is
 
                      Apply_Compile_Time_Constraint_Error
                        (N, "division by zero", CE_Divide_By_Zero,
+                        Loc  => Sloc (Right),
                         Warn => not Stat or SPARK_Mode = On);
                      return;
 
@@ -2139,6 +2140,7 @@ package body Sem_Eval is
 
                      Apply_Compile_Time_Constraint_Error
                        (N, "mod with zero divisor", CE_Divide_By_Zero,
+                        Loc  => Sloc (Right),
                         Warn => not Stat or SPARK_Mode = On);
                      return;
 
@@ -2159,6 +2161,7 @@ package body Sem_Eval is
 
                      Apply_Compile_Time_Constraint_Error
                        (N, "rem with zero divisor", CE_Divide_By_Zero,
+                        Loc  => Sloc (Right),
                         Warn => not Stat or SPARK_Mode = On);
                      return;
 
@@ -2218,7 +2221,8 @@ package body Sem_Eval is
             else pragma Assert (Nkind (N) = N_Op_Divide);
                if UR_Is_Zero (Right_Real) then
                   Apply_Compile_Time_Constraint_Error
-                    (N, "division by zero", CE_Divide_By_Zero);
+                    (N, "division by zero", CE_Divide_By_Zero,
+                     Loc => Sloc (Right));
                   return;
                end if;