Commit 05c1e7d2 by Arnaud Charlet

[multiple changes]

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.

From-SVN: r179256
parent 65e78a74
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> 2011-09-27 Ed Schonberg <schonberg@adacore.com>
* sinfo.ads, par-ch3.adb: Minor comment update: aspect specification * sinfo.ads, par-ch3.adb: Minor comment update: aspect specification
......
...@@ -1879,7 +1879,7 @@ package body Checks is ...@@ -1879,7 +1879,7 @@ package body Checks is
Arr_Typ := Get_Actual_Subtype_If_Available (Arr); Arr_Typ := Get_Actual_Subtype_If_Available (Arr);
if Is_Access_Type (Arr_Typ) then if Is_Access_Type (Arr_Typ) then
Arr_Typ := Directly_Designated_Type (Arr_Typ); Arr_Typ := Designated_Type (Arr_Typ);
end if; end if;
end if; end if;
......
...@@ -4710,7 +4710,6 @@ package body Exp_Aggr is ...@@ -4710,7 +4710,6 @@ package body Exp_Aggr is
and then Static_Elaboration_Desired (Current_Scope) and then Static_Elaboration_Desired (Current_Scope)
then then
Convert_To_Positional (N, Max_Others_Replicate => 100); Convert_To_Positional (N, Max_Others_Replicate => 100);
else else
Convert_To_Positional (N); Convert_To_Positional (N);
end if; end if;
......
...@@ -5917,13 +5917,68 @@ package body Exp_Util is ...@@ -5917,13 +5917,68 @@ package body Exp_Util is
then then
return False; return False;
-- The following test is the simplest way of solving a complex -- Note: The following test is the simplest way of solving a complex
-- problem uncovered by B808-010: Side effect on loop bound that -- problem uncovered by the following test (Side effect on loop bound
-- is a subcomponent of a global variable: -- that is a subcomponent of a global variable:
-- If a loop bound is a subcomponent of a global variable, a -- with Text_Io; use Text_Io;
-- modification of that variable within the loop may incorrectly -- procedure Tloop is
-- affect the execution of the loop. -- 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 elsif Nkind (Parent (Parent (N))) = N_Loop_Parameter_Specification
and then Within_In_Parameter (Prefix (N)) and then Within_In_Parameter (Prefix (N))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment