aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2005-03-15 16:58:36 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2005-03-15 16:58:36 +0100
commit3a8b9f38bfc03d50be0e81ede68f9fc00cc9451d (patch)
tree1aec1166ddef256ff7088739e1ab2fd2d869f0d2 /gcc
parent2ca2bc8b83f876989574ad3da8285ebf8a7728cd (diff)
downloadgcc-3a8b9f38bfc03d50be0e81ede68f9fc00cc9451d.zip
gcc-3a8b9f38bfc03d50be0e81ede68f9fc00cc9451d.tar.gz
gcc-3a8b9f38bfc03d50be0e81ede68f9fc00cc9451d.tar.bz2
checks.adb (Get_E_First_Or_Last): When the expression being retrieved is an N_Raise_Constraint_Error node...
2005-03-08 Thomas Quinot <quinot@adacore.com> * checks.adb (Get_E_First_Or_Last): When the expression being retrieved is an N_Raise_Constraint_Error node, create a new copy of it without going through a call to Duplicate_Subexpr. From-SVN: r96491
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/checks.adb12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 6801837..1f66e3c 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -5775,7 +5775,17 @@ package body Checks is
return Get_Discriminal (E, Bound);
elsif Nkind (Bound) = N_Integer_Literal then
- return Make_Integer_Literal (Loc, Intval (Bound));
+ return Make_Integer_Literal (Loc, Intval (Bound));
+
+ -- Case of a bound that has been rewritten to an
+ -- N_Raise_Constraint_Error node because it is an out-of-range
+ -- value. We may not call Duplicate_Subexpr on this node because
+ -- an N_Raise_Constraint_Error is not side effect free, and we may
+ -- not assume that we are in the proper context to remove side
+ -- effects on it at the point of reference.
+
+ elsif Nkind (Bound) = N_Raise_Constraint_Error then
+ return New_Copy_Tree (Bound);
else
return Duplicate_Subexpr_No_Checks (Bound);