]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 6 Aug 2012 08:32:05 +0000 (10:32 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 6 Aug 2012 08:32:05 +0000 (10:32 +0200)
2012-08-06  Yannick Moy  <moy@adacore.com>

* sem_ch4.adb (Analyze_Selected_Component): Issue an error in
Alfa mode for component not present.

2012-08-06  Thomas Quinot  <quinot@adacore.com>

* exp_ch7.adb (Insert_Actions_In_Scope_Around): Do not
use a renaming of Scope_Stack.Table (Scope_Stack.Last), as
Process_Transient_Object may introduce new scopes and cause
Scope_Stack.Table to be reallocated.

From-SVN: r190167

gcc/ada/ChangeLog
gcc/ada/exp_ch7.adb
gcc/ada/sem_ch4.adb

index abd977a7afa522bc8976a743595fbd0e1014138c..e75adb756a4d1be54d7d361f2be19e42d84710fe 100644 (file)
@@ -1,3 +1,15 @@
+2012-08-06  Yannick Moy  <moy@adacore.com>
+
+       * sem_ch4.adb (Analyze_Selected_Component): Issue an error in
+       Alfa mode for component not present.
+
+2012-08-06  Thomas Quinot  <quinot@adacore.com>
+
+       * exp_ch7.adb (Insert_Actions_In_Scope_Around): Do not
+       use a renaming of Scope_Stack.Table (Scope_Stack.Last), as
+       Process_Transient_Object may introduce new scopes and cause
+       Scope_Stack.Table to be reallocated.
+
 2012-08-06  Robert Dewar  <dewar@adacore.com>
 
        * exp_util.adb, switch-c.adb, inline.ads, sem_ch10.adb, types.ads,
index 7e28bb4c1396f75136d8e74760b762ca5ca0c0f1..725cd2ac4b6f88a16098a99d280a6166f5b85201 100644 (file)
@@ -4345,9 +4345,13 @@ package body Exp_Ch7 is
    ------------------------------------
 
    procedure Insert_Actions_In_Scope_Around (N : Node_Id) is
-      SE     : Scope_Stack_Entry renames Scope_Stack.Table (Scope_Stack.Last);
-      After  : List_Id renames SE.Actions_To_Be_Wrapped_After;
-      Before : List_Id renames SE.Actions_To_Be_Wrapped_Before;
+      After  : constant List_Id :=
+        Scope_Stack.Table (Scope_Stack.Last).Actions_To_Be_Wrapped_After;
+      Before : constant List_Id :=
+        Scope_Stack.Table (Scope_Stack.Last).Actions_To_Be_Wrapped_Before;
+      --  Note: We used to use renamings of Scope_Stack.Table (Scope_Stack.
+      --  Last), but this was incorrect as Process_Transient_Object may
+      --  introduce new scopes and cause a reallocation of Scope_Stack.Table.
 
       procedure Process_Transient_Objects
         (First_Object : Node_Id;
@@ -4694,11 +4698,13 @@ package body Exp_Ch7 is
          --  Reset the action lists
 
          if Present (Before) then
-            Before := No_List;
+            Scope_Stack.Table (Scope_Stack.Last).
+              Actions_To_Be_Wrapped_Before := No_List;
          end if;
 
          if Present (After) then
-            After := No_List;
+            Scope_Stack.Table (Scope_Stack.Last).
+              Actions_To_Be_Wrapped_After := No_List;
          end if;
       end;
    end Insert_Actions_In_Scope_Around;
index 04305784f6e25bd25379b80891ab46e5dedade64..557d61624b7135aebac1e5322c693849282df121 100644 (file)
@@ -4343,10 +4343,22 @@ package body Sem_Ch4 is
                      --  Emit appropriate message. Gigi will replace the
                      --  node subsequently with the appropriate Raise.
 
-                     Apply_Compile_Time_Constraint_Error
-                       (N, "component not present in }?",
-                        CE_Discriminant_Check_Failed,
-                        Ent => Prefix_Type, Rep => False);
+                     --  In Alfa mode, this is an made into an error to
+                     --  simplify the treatment of the formal verification
+                     --  backend.
+
+                     if Alfa_Mode then
+                        Apply_Compile_Time_Constraint_Error
+                          (N, "component not present in }",
+                           CE_Discriminant_Check_Failed,
+                           Ent => Prefix_Type, Rep => False);
+                     else
+                        Apply_Compile_Time_Constraint_Error
+                          (N, "component not present in }?",
+                           CE_Discriminant_Check_Failed,
+                           Ent => Prefix_Type, Rep => False);
+                     end if;
+
                      Set_Raises_Constraint_Error (N);
                      return;
                   end if;