summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_prag.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_prag.adb')
-rw-r--r--gcc/ada/exp_prag.adb9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index 22e9bb04691..8cb084d6ba2 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -270,10 +270,17 @@ package body Exp_Prag is
procedure Expand_Pragma_Check (N : Node_Id) is
Cond : constant Node_Id := Arg2 (N);
- Loc : constant Source_Ptr := Sloc (Cond);
Nam : constant Name_Id := Chars (Arg1 (N));
Msg : Node_Id;
+ Loc : constant Source_Ptr := Sloc (First_Node (Cond));
+ -- Source location used in the case of a failed assertion. Note that
+ -- the source location of the expression is not usually the best choice
+ -- here. For example, it gets located on the last AND keyword in a
+ -- chain of boolean expressiond AND'ed together. It is best to put the
+ -- message on the first character of the assertion, which is the effect
+ -- of the First_Node call here.
+
begin
-- We already know that this check is enabled, because otherwise the
-- semantic pass dealt with rewriting the assertion (see Sem_Prag)