diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-15 15:58:36 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-15 15:58:36 +0000 |
commit | 18563cef8e0580374758cc830b4b4b249176875b (patch) | |
tree | 1aec1166ddef256ff7088739e1ab2fd2d869f0d2 /gcc/ada/checks.adb | |
parent | d70083776f61dcad687a0eb3bd422a3fd53eeee4 (diff) | |
download | gcc-18563cef8e0580374758cc830b4b4b249176875b.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96491 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r-- | gcc/ada/checks.adb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 6801837afc7..1f66e3c43f4 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); |