Commit 597d7158 by Gary Dismukes Committed by Arnaud Charlet

exp_aggr.adb (Static_Array_Aggregate): When a static array aggregate with a…

exp_aggr.adb (Static_Array_Aggregate): When a static array aggregate with a range is transformed into a positional...

2008-08-22  Gary Dismukes  <dismukes@adacore.com>

	* 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
parent 5f0085c7
...@@ -6442,6 +6442,12 @@ package body Exp_Aggr is ...@@ -6442,6 +6442,12 @@ package body Exp_Aggr is
Append_To Append_To
(Expressions (Agg), New_Copy (Expression (Expr))); (Expressions (Agg), New_Copy (Expression (Expr)));
Set_Etype (Last (Expressions (Agg)), Component_Type (Typ)); 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; end loop;
Set_Aggregate_Bounds (Agg, Bounds); Set_Aggregate_Bounds (Agg, Bounds);
......
...@@ -998,14 +998,17 @@ package body Sem_Eval is ...@@ -998,14 +998,17 @@ package body Sem_Eval is
return False; return False;
end if; end if;
-- If this is not a static expression and we are in configurable run -- If this is not a static expression or a null literal, and we are in
-- time mode, then we consider it not known at compile time. This -- configurable run-time mode, then we consider it not known at compile
-- avoids anomalies where whether something is permitted with a given -- time. This avoids anomalies where whether something is allowed with a
-- configurable run-time library depends on how good the compiler is -- given configurable run-time library depends on how good the compiler
-- at optimizing and knowing that things are constant when they -- is at optimizing and knowing that things are constant when they are
-- are non-static. -- nonstatic.
if Configurable_Run_Time_Mode and then not Is_Static_Expression (Op) then if Configurable_Run_Time_Mode
and then K /= N_Null
and then not Is_Static_Expression (Op)
then
return False; return False;
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment