diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-01-25 15:53:51 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-01-25 15:53:51 +0100 |
commit | d610088df8ab520a63e2790a07a0d54362dea62a (patch) | |
tree | 1de77ca9c18ddb8c75a172fb11c9bee5551fd74c /gcc | |
parent | 64425dffa1513abb8f542cd7e51cae8b5e35cd7c (diff) | |
download | gcc-d610088df8ab520a63e2790a07a0d54362dea62a.zip gcc-d610088df8ab520a63e2790a07a0d54362dea62a.tar.gz gcc-d610088df8ab520a63e2790a07a0d54362dea62a.tar.bz2 |
[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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/sem_aggr.adb | 10 | ||||
-rw-r--r-- | gcc/ada/sem_eval.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sinfo.ads | 18 |
4 files changed, 30 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 84e7e85..d7fb8cb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +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> * 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 ad01bd1..d28389a 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 6e06e83..c63a1cc 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 bb60129..7fc555a 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. ---------------------------------------------- |