[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 25 Jan 2010 14:53:51 +0000 (15:53 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 25 Jan 2010 14:53:51 +0000 (15:53 +0100)
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

gcc/ada/ChangeLog
gcc/ada/sem_aggr.adb
gcc/ada/sem_eval.adb
gcc/ada/sinfo.ads

index 84e7e8549c9a8a219d20bccdcb4f3e4f2e54c4cf..d7fb8cbc7cc8edc1c86e70062f7d00cd3c0cb30c 100644 (file)
@@ -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.
index ad01bd18117ef21832eae26d87b99be01a734ea6..d28389a6180ccc88c65db5a9653a4de0d59c42c8 100644 (file)
@@ -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);
index 6e06e8353ae1c9747eee3e993ccb84d29df74755..c63a1cc5a8dc7d5f8e2457dd939a3fff94085645 100644 (file)
@@ -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
index bb6012904a9d004cf340538639723fa051e9339b..7fc555a80ae6b443fb513c8be98deed7269c401c 100644 (file)
@@ -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.
 
       ----------------------------------------------