aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/exp_ch3.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 97988bb..c5ed468 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -7534,6 +7534,7 @@ package body Exp_Ch3 is
elsif Comes_From_Source (N)
and then Is_Discrete_Type (Typ)
and then Expr_Known_Valid (Expr)
+ and then Safe_To_Capture_Value (N, Def_Id)
then
Set_Is_Known_Valid (Def_Id);
@@ -7564,7 +7565,9 @@ package body Exp_Ch3 is
and then not Is_Generic_Type (Etype (Def_Id))
then
Ensure_Valid (Expr);
- Set_Is_Known_Valid (Def_Id);
+ if Safe_To_Capture_Value (N, Def_Id) then
+ Set_Is_Known_Valid (Def_Id);
+ end if;
end if;
end if;