Commit ed789fe9 by Cyrille Comar Committed by Arnaud Charlet

exp_ch5.adb (Expand_N_Assignment_Statement, [...]): For an assignment of a value…

exp_ch5.adb (Expand_N_Assignment_Statement, [...]): For an assignment of a value of a tagged type that has been rewritten to a...

2005-11-14  Cyrille Comar  <comar@adacore.com>
	    Thomas Quinot  <quinot@adacore.com>

	* exp_ch5.adb (Expand_N_Assignment_Statement, Tagged_Case): For an
	assignment of a value of a tagged type that has been rewritten to a
	block statement, it is known by construction that no checks are
	necessary for the statements within the block: analyze it with checks
	suppressed.
	(Expand_N_If_Statement): When killing a dead then-branch in an
	if-statement that has elsif_parts, recompute the Current_Value node
	for any entity whose value is known from the condition of the first
	elsif_part.
	(Expand_N_Return_Statement): When returning a mutable record, convert
	the return value into its actual subtype in order to help the backend
	to return the actual size instead of the maximum. This is another
	aftermath of not returning mutable records on the sec-stack anymore.

	* sem_ch5.ads, sem_ch5.adb (Analyze_Iteration_Scheme): Minor change to
	handling of error msg for suspicious reverse range iteration.
	(Check_Possible_Current_Value_Condition): Move declaration from body to
	spec, to allow this subprogram to be called from exp_ch5.

From-SVN: r106972
parent 5dcc05e6
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -71,15 +71,6 @@ package body Sem_Ch5 is ...@@ -71,15 +71,6 @@ package body Sem_Ch5 is
procedure Analyze_Iteration_Scheme (N : Node_Id); procedure Analyze_Iteration_Scheme (N : Node_Id);
procedure Check_Possible_Current_Value_Condition (Cnode : Node_Id);
-- Cnode is N_If_Statement, N_Elsif_Part, or N_Iteration_Scheme
-- (the latter when a WHILE condition is present). This call checks
-- if Condition (Cnode) is of the form ([NOT] var op val), where var
-- is a simple object, val is known at compile time, and op is one
-- of the six relational operators. If this is the case, and the
-- Current_Value field of "var" is not set, then it is set to Cnode.
-- See Exp_Util.Set_Current_Value_Condition for further details.
------------------------ ------------------------
-- Analyze_Assignment -- -- Analyze_Assignment --
------------------------ ------------------------
...@@ -1526,13 +1517,15 @@ package body Sem_Ch5 is ...@@ -1526,13 +1517,15 @@ package body Sem_Ch5 is
-- of reversing the bounds incorrectly in the range. -- of reversing the bounds incorrectly in the range.
elsif Reverse_Present (LP) elsif Reverse_Present (LP)
and then Nkind (H) = N_Integer_Literal and then Nkind (Original_Node (H)) =
N_Integer_Literal
and then (Intval (H) = Uint_0 and then (Intval (H) = Uint_0
or else or else
Intval (H) = Uint_1) Intval (H) = Uint_1)
and then Lhi > Hhi and then Lhi > Hhi
then then
Error_Msg_N ("?loop range may be null", DS); Error_Msg_N ("?loop range may be null", DS);
Error_Msg_N ("\?bounds may be wrong way round", DS);
end if; end if;
end; end;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1992-2002 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -47,6 +47,15 @@ package Sem_Ch5 is ...@@ -47,6 +47,15 @@ package Sem_Ch5 is
-- care of setting Reachable, since labels defined by the expander can -- care of setting Reachable, since labels defined by the expander can
-- be assumed to be reachable. -- be assumed to be reachable.
procedure Check_Possible_Current_Value_Condition (Cnode : Node_Id);
-- Cnode is N_If_Statement, N_Elsif_Part, or N_Iteration_Scheme
-- (the latter when a WHILE condition is present). This call checks
-- if Condition (Cnode) is of the form ([NOT] var op val), where var
-- is a simple object, val is known at compile time, and op is one
-- of the six relational operators. If this is the case, and the
-- Current_Value field of "var" is not set, then it is set to Cnode.
-- See Exp_Util.Set_Current_Value_Condition for further details.
procedure Check_Unreachable_Code (N : Node_Id); procedure Check_Unreachable_Code (N : Node_Id);
-- This procedure is called with N being the node for a statement that -- This procedure is called with N being the node for a statement that
-- is an unconditional transfer of control. It checks to see if the -- is an unconditional transfer of control. It checks to see if the
......
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