Commit d610088d by Arnaud Charlet

[multiple changes]

2010-01-25  Ed Schonberg  <schonberg@adacore.com>

	* sem_aggr.adb (Resolve_Array_Aggregate): If the bounds in a choice
	have errors, do not continue resolution of the aggregate.
	* sem_eval.adb (Eval_Indexed_Component): Do not attempt to evaluate if
	the array type indicates an error.

2010-01-25  Bob Duff  <duff@adacore.com>

	* sinfo.ads: Minor comment fixes.

From-SVN: r156212
parent 64425dff
2010-01-25 Ed Schonberg <schonberg@adacore.com>
* sem_aggr.adb (Resolve_Array_Aggregate): If the bounds in a choice
have errors, do not continue resolution of the aggregate.
* sem_eval.adb (Eval_Indexed_Component): Do not attempt to evaluate if
the array type indicates an error.
2010-01-25 Bob Duff <duff@adacore.com>
* sinfo.ads: Minor comment fixes.
2010-01-25 Bob Duff <duff@adacore.com> 2010-01-25 Bob Duff <duff@adacore.com>
* exp_ch4.adb, exp_aggr.adb: Minor comment fixes and code clean up. * exp_ch4.adb, exp_aggr.adb: Minor comment fixes and code clean up.
......
...@@ -1936,6 +1936,16 @@ package body Sem_Aggr is ...@@ -1936,6 +1936,16 @@ package body Sem_Aggr is
and then Compile_Time_Known_Value (Choices_Low) and then Compile_Time_Known_Value (Choices_Low)
and then Compile_Time_Known_Value (Choices_High) and then Compile_Time_Known_Value (Choices_High)
then then
-- If the bounds have semantic errors, do not attempt
-- further resolution to prevent cascaded errors..
if Error_Posted (Choices_Low)
or else Error_Posted (Choices_High)
then
return False;
end if;
declare declare
ALo : constant Node_Id := Expr_Value_E (Aggr_Low); ALo : constant Node_Id := Expr_Value_E (Aggr_Low);
AHi : constant Node_Id := Expr_Value_E (Aggr_High); AHi : constant Node_Id := Expr_Value_E (Aggr_High);
......
...@@ -1915,7 +1915,9 @@ package body Sem_Eval is ...@@ -1915,7 +1915,9 @@ package body Sem_Eval is
-- are error cases where this is not the case), then see if we -- are error cases where this is not the case), then see if we
-- can do a constant evaluation of the array reference. -- can do a constant evaluation of the array reference.
if Is_Array_Type (Atyp) then if Is_Array_Type (Atyp)
and then Atyp /= Any_Composite
then
if Ekind (Atyp) = E_String_Literal_Subtype then if Ekind (Atyp) = E_String_Literal_Subtype then
Lbd := String_Literal_Low_Bound (Atyp); Lbd := String_Literal_Low_Bound (Atyp);
else else
......
...@@ -576,15 +576,9 @@ package Sinfo is ...@@ -576,15 +576,9 @@ package Sinfo is
-- issues. Used to inhibit multiple redundant messages. -- issues. Used to inhibit multiple redundant messages.
-- Aggregate_Bounds (Node3-Sem) -- Aggregate_Bounds (Node3-Sem)
-- Present in array N_Aggregate nodes. If the aggregate contains -- Present in array N_Aggregate nodes. If the bounds of the aggregate are
-- component associations this field points to an N_Range node whose -- known at compile time, this field points to an N_Range node with those
-- bounds give the lowest and highest discrete choice values. If the -- bounds. Otherwise Empty.
-- named aggregate contains a dynamic or null choice this field is empty.
-- If the aggregate contains positional elements this field points to an
-- N_Integer_Literal node giving the number of positional elements. Note
-- that if the aggregate contains positional elements and an other choice
-- the N_Integer_Literal only accounts for the number of positional
-- elements.
-- All_Others (Flag11-Sem) -- All_Others (Flag11-Sem)
-- Present in an N_Others_Choice node. This flag is set for an others -- Present in an N_Others_Choice node. This flag is set for an others
...@@ -3302,10 +3296,10 @@ package Sinfo is ...@@ -3302,10 +3296,10 @@ package Sinfo is
-- are not met, then the front end must translate the aggregate into -- are not met, then the front end must translate the aggregate into
-- an appropriate set of assignments into a temporary. -- an appropriate set of assignments into a temporary.
-- Note: for the record aggregate case, gigi/gcc can handle all cases -- Note: for the record aggregate case, gigi/gcc can handle all cases of
-- of record aggregates, including those for packed, and rep-claused -- record aggregates, including those for packed, and rep-claused
-- records, and also variant records, providing that there are no -- records, and also variant records, providing that there are no
-- variable length fields whose size is not known at runtime, and -- variable length fields whose size is not known at compile time, and
-- providing that the aggregate is presented in fully named form. -- providing that the aggregate is presented in fully named form.
---------------------------------------------- ----------------------------------------------
......
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