From: Arnaud Charlet Date: Mon, 25 Jan 2010 14:53:51 +0000 (+0100) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d610088df8ab520a63e2790a07a0d54362dea62a;p=gcc.git [multiple changes] 2010-01-25 Ed Schonberg * 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 * sinfo.ads: Minor comment fixes. From-SVN: r156212 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 84e7e8549c9..d7fb8cbc7cc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2010-01-25 Ed Schonberg + + * 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 + + * sinfo.ads: Minor comment fixes. + 2010-01-25 Bob Duff * exp_ch4.adb, exp_aggr.adb: Minor comment fixes and code clean up. diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index ad01bd18117..d28389a6180 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1936,6 +1936,16 @@ package body Sem_Aggr is and then Compile_Time_Known_Value (Choices_Low) and then Compile_Time_Known_Value (Choices_High) 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 ALo : constant Node_Id := Expr_Value_E (Aggr_Low); AHi : constant Node_Id := Expr_Value_E (Aggr_High); diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 6e06e8353ae..c63a1cc5a8d 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -1915,7 +1915,9 @@ package body Sem_Eval is -- are error cases where this is not the case), then see if we -- 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 Lbd := String_Literal_Low_Bound (Atyp); else diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index bb6012904a9..7fc555a80ae 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -576,15 +576,9 @@ package Sinfo is -- issues. Used to inhibit multiple redundant messages. -- Aggregate_Bounds (Node3-Sem) - -- Present in array N_Aggregate nodes. If the aggregate contains - -- component associations this field points to an N_Range node whose - -- bounds give the lowest and highest discrete choice values. If the - -- 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. + -- Present in array N_Aggregate nodes. If the bounds of the aggregate are + -- known at compile time, this field points to an N_Range node with those + -- bounds. Otherwise Empty. -- All_Others (Flag11-Sem) -- Present in an N_Others_Choice node. This flag is set for an others @@ -3302,10 +3296,10 @@ package Sinfo is -- are not met, then the front end must translate the aggregate into -- an appropriate set of assignments into a temporary. - -- Note: for the record aggregate case, gigi/gcc can handle all cases - -- of record aggregates, including those for packed, and rep-claused + -- Note: for the record aggregate case, gigi/gcc can handle all cases of + -- record aggregates, including those for packed, and rep-claused -- 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. ----------------------------------------------