OSDN Git Service

2011-09-27 Eric Botcazou <ebotcazou@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Sep 2011 09:57:19 +0000 (09:57 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 27 Sep 2011 09:57:19 +0000 (09:57 +0000)
* checks.adb (Apply_Scalar_Range_Check): Use Designated_Type
instead of Directly_Designated_Type in the indirect array case.

2011-09-27  Robert Dewar  <dewar@adacore.com>

* exp_util.adb, exp_aggr.adb: Minor reformatting.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179256 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/exp_aggr.adb
gcc/ada/exp_util.adb

index e0660c0..d1fc22a 100644 (file)
@@ -1,3 +1,12 @@
+2011-09-27  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * checks.adb (Apply_Scalar_Range_Check): Use Designated_Type
+       instead of Directly_Designated_Type in the indirect array case.
+
+2011-09-27  Robert Dewar  <dewar@adacore.com>
+
+       * exp_util.adb, exp_aggr.adb: Minor reformatting.
+
 2011-09-27  Ed Schonberg  <schonberg@adacore.com>
 
        * sinfo.ads, par-ch3.adb: Minor comment update: aspect specification
index 0d2322a..e07d70e 100644 (file)
@@ -1879,7 +1879,7 @@ package body Checks is
          Arr_Typ := Get_Actual_Subtype_If_Available (Arr);
 
          if Is_Access_Type (Arr_Typ) then
-            Arr_Typ := Directly_Designated_Type (Arr_Typ);
+            Arr_Typ := Designated_Type (Arr_Typ);
          end if;
       end if;
 
index 6cf3b16..d06d8b9 100644 (file)
@@ -4710,7 +4710,6 @@ package body Exp_Aggr is
         and then Static_Elaboration_Desired (Current_Scope)
       then
          Convert_To_Positional (N, Max_Others_Replicate => 100);
-
       else
          Convert_To_Positional (N);
       end if;
index 753fea3..295006a 100644 (file)
@@ -5917,13 +5917,68 @@ package body Exp_Util is
          then
             return False;
 
-         --  The following test is the simplest way of solving a complex
-         --  problem uncovered by B808-010: Side effect on loop bound that
-         --  is a subcomponent of a global variable:
-
-         --    If a loop bound is a subcomponent of a global variable, a
-         --    modification of that variable within the loop may incorrectly
-         --    affect the execution of the loop.
+         --  Note: The following test is the simplest way of solving a complex
+         --  problem uncovered by the following test (Side effect on loop bound
+         --  that is a subcomponent of a global variable:
+
+         --    with Text_Io; use Text_Io;
+         --    procedure Tloop is
+         --      type X is
+         --        record
+         --          V : Natural := 4;
+         --          S : String (1..5) := (others => 'a');
+         --        end record;
+         --      X1 : X;
+
+         --      procedure Modi;
+
+         --      generic
+         --        with procedure Action;
+         --      procedure Loop_G (Arg : X; Msg : String)
+
+         --      procedure Loop_G (Arg : X; Msg : String) is
+         --      begin
+         --        Put_Line ("begin loop_g " & Msg & " will loop till: "
+         --                  & Natural'Image (Arg.V));
+         --        for Index in 1 .. Arg.V loop
+         --          Text_Io.Put_Line
+         --            (Natural'Image (Index) & " " & Arg.S (Index));
+         --          if Index > 2 then
+         --            Modi;
+         --          end if;
+         --        end loop;
+         --        Put_Line ("end loop_g " & Msg);
+         --      end;
+
+         --      procedure Loop1 is new Loop_G (Modi);
+         --      procedure Modi is
+         --      begin
+         --        X1.V := 1;
+         --        Loop1 (X1, "from modi");
+         --      end;
+         --
+         --    begin
+         --      Loop1 (X1, "initial");
+         --    end;
+
+         --  The output of the above program should be:
+
+         --    begin loop_g initial will loop till:  4
+         --     1 a
+         --     2 a
+         --     3 a
+         --    begin loop_g from modi will loop till:  1
+         --     1 a
+         --    end loop_g from modi
+         --     4 a
+         --    begin loop_g from modi will loop till:  1
+         --     1 a
+         --    end loop_g from modi
+         --    end loop_g initial
+
+         --  If a loop bound is a subcomponent of a global variable, a
+         --  modification of that variable within the loop may incorrectly
+         --  affect the execution of the loop.
 
          elsif Nkind (Parent (Parent (N))) = N_Loop_Parameter_Specification
            and then Within_In_Parameter (Prefix (N))