From 597d7158c66a05d0324c54c6dbaafb999f049301 Mon Sep 17 00:00:00 2001 From: Gary Dismukes Date: Fri, 22 Aug 2008 14:12:04 +0200 Subject: [PATCH] exp_aggr.adb (Static_Array_Aggregate): When a static array aggregate with a range is transformed into a positional... 2008-08-22 Gary Dismukes * exp_aggr.adb (Static_Array_Aggregate): When a static array aggregate with a range is transformed into a positional aggregate, any copied component literals should be marked Is_Static_Expression. * sem_eval.adb (Compile_Time_Known_Value): Don't treat null literals as not being known at at compile time when Configurable_Run_Time_Mode is true. From-SVN: r139442 --- gcc/ada/exp_aggr.adb | 6 ++++++ gcc/ada/sem_eval.adb | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index bc3b954fb6c..e8b1e732e2b 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -6442,6 +6442,12 @@ package body Exp_Aggr is Append_To (Expressions (Agg), New_Copy (Expression (Expr))); Set_Etype (Last (Expressions (Agg)), Component_Type (Typ)); + + -- Integer literals should always be marked as static + + if Nkind (Expression (Expr)) = N_Integer_Literal then + Set_Is_Static_Expression (Last (Expressions (Agg))); + end if; end loop; Set_Aggregate_Bounds (Agg, Bounds); diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index d8067915838..3e90538c3b6 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -998,14 +998,17 @@ package body Sem_Eval is return False; end if; - -- If this is not a static expression and we are in configurable run - -- time mode, then we consider it not known at compile time. This - -- avoids anomalies where whether something is permitted with a given - -- configurable run-time library depends on how good the compiler is - -- at optimizing and knowing that things are constant when they - -- are non-static. - - if Configurable_Run_Time_Mode and then not Is_Static_Expression (Op) then + -- If this is not a static expression or a null literal, and we are in + -- configurable run-time mode, then we consider it not known at compile + -- time. This avoids anomalies where whether something is allowed with a + -- given configurable run-time library depends on how good the compiler + -- is at optimizing and knowing that things are constant when they are + -- nonstatic. + + if Configurable_Run_Time_Mode + and then K /= N_Null + and then not Is_Static_Expression (Op) + then return False; end if; -- 2.11.4.GIT