Commit 59e54267 by Ed Schonberg Committed by Arnaud Charlet

re PR ada/18819 (ACATS cdd2a02 fail at runtime)

2006-02-13  Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>

	* exp_util.ads, exp_util.adb (Find_Prim_Op,
	Is_Predefined_Primitive_Operation): When
	searching for the predefined equality operator, verify that operands
	have the same type.
	(Is_Predefined_Dispatching_Operation): Remove the code that looks
	for the last entity in the list of aliased subprograms. This code
	was wrong in case of renamings.
	(Set_Renamed_Subprogram): New procedure
	(Remove_Side_Effects): Replace calls to Etype (Exp) with use of the
	Exp_Type constant computed when entering this subprogram.
	(Known_Null): New function
	(OK_To_Do_Constant_Replacement): New function
	(Known_Non_Null): Check scope before believing Is_Known_Non_Null flag
	(Side_Effect_Free): An attribute reference 'Input is not free of
	side effect, unlike other attributes that are functions. (from code
	reading).
	(Remove_Side_Effects): Expressions that involve packed arrays or records
	are copied at the point of reference, and therefore must be marked as
	renamings of objects.
	(Is_Predefined_Dispatching_Operation): Return false if the operation is
	not a dispatching operation.

	PR ada/18819
	(Remove_Side_Effects): Lift enclosing type conversion nodes for
	elementary types in all cases.

From-SVN: r111069
parent f55cfa2e
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- 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- --
......@@ -464,10 +464,8 @@ package Exp_Util is
-- False otherwise. True for an empty list. It is an error to call this
-- routine with No_List as the argument.
function Is_Predefined_Dispatching_Operation
(Subp : Entity_Id) return Boolean;
-- Ada 2005 (AI-251): Determines if Subp is a predefined primitive
-- operation.
function Is_Predefined_Dispatching_Operation (E : Entity_Id) return Boolean;
-- Ada 2005 (AI-251): Determines if E is a predefined primitive operation.
function Is_Ref_To_Bit_Packed_Array (N : Node_Id) return Boolean;
-- Determine whether the node P is a reference to a bit packed array, i.e.
......@@ -527,6 +525,12 @@ package Exp_Util is
-- be non-null and returns True if so. Returns False otherwise. It is
-- an error to call this function if N is not of an access type.
function Known_Null (N : Node_Id) return Boolean;
-- Given a node N for a subexpression of an access type, determines if this
-- subexpression yields a value that is known at compile time to be null
-- and returns True if so. Returns False otherwise. It is an error to call
-- this function if N is not of an access type.
function Make_Subtype_From_Expr
(E : Node_Id;
Unc_Typ : Entity_Id) return Node_Id;
......@@ -544,6 +548,18 @@ package Exp_Util is
-- caller has to check whether stack checking is actually enabled in order
-- to guide the expansion (typically of a function call).
function OK_To_Do_Constant_Replacement (E : Entity_Id) return Boolean;
-- This function is used when testing whether or not to replace a reference
-- to entity E by a known constant value. Such replacement must be done
-- only in a scope known to be safe for such replacements. In particular,
-- if we are within a subprogram and the entity E is declared outside the
-- subprogram then we cannot do the replacement, since we do not attempt to
-- trace subprogram call flow. It is also unsafe to replace statically
-- allocated values (since they can be modified outside the scope), and we
-- also inhibit replacement of Volatile or aliased objects since their
-- address might be captured in a way we do not detect. A value of True is
-- returned only if the replacement is safe.
procedure Remove_Side_Effects
(Exp : Node_Id;
Name_Req : Boolean := False;
......@@ -583,6 +599,11 @@ package Exp_Util is
-- can detect cases where this is the only elaboration action that is
-- required.
procedure Set_Renamed_Subprogram (N : Node_Id; E : Entity_Id);
-- N is an node which is an entity name that represents the name of a
-- renamed subprogram. The node is rewritten to be an identifier that
-- refers directly to the renamed subprogram, given by entity E.
function Target_Has_Fixed_Ops
(Left_Typ : Entity_Id;
Right_Typ : Entity_Id;
......
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