summaryrefslogtreecommitdiffstats
path: root/gcc/ada/exp_ch7.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-19 10:57:20 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-19 10:57:20 +0000
commitcb22648259a0fb6992dcd74e03e2e1a533544577 (patch)
tree180c6c1639dfdeda66e9fb2b12980eae5f2ba409 /gcc/ada/exp_ch7.adb
parent25ba8eb38bbbc147d86796ff8db54c44252709f7 (diff)
downloadppe42-gcc-cb22648259a0fb6992dcd74e03e2e1a533544577.tar.gz
ppe42-gcc-cb22648259a0fb6992dcd74e03e2e1a533544577.zip
* exp_ch4.adb (Expand_N_Selected_Component): If the component is the
discriminant of a constrained subtype, analyze the copy of the corresponding constraint, because in some cases it may be only partially analyzed. Removes long-lived ??? comments. * exp_ch7.adb (Establish_Transient_Scope): Remove complex code that handled controlled or secondary-stack expressions within the iteration_scheme of a loop. * sem_ch5.adb (Analyze_Iteration_Scheme): Build a block to evaluate bounds that may contain functions calls, to prevent memory leaks when the bound contains a call to a function that uses the secondary stack. (Check_Complex_Bounds): Subsidiary of Analyze_Iteration_Scheme, to generate temporaries for loop bounds that might contain function calls that require secondary stack and/or finalization actions. * sem_ch4.adb (Analyze_Indexed_Component_Form): If the prefix is a selected component and the selector is overloadable (not just a function) treat as function call, Analyze_Call will disambiguate if necessary. (Analyze_Selected_Component): Do not generate an actual subtype for the selected component if expansion is disabled. The actual subtype is only needed for constraint checks. (Analyze_Allocator): If restriction No_Streams is set, then do not permit objects to be declared of a stream type, or of a composite type containing a stream. * restrict.ads: Remove the a-stream entry from Unit_Array, since No_Streams no longer prohibits with'ing this package. * sem_ch3.adb (Build_Derived_Record_Type): If the parent type has discriminants, but the parent base has unknown discriminants, there is no discriminant constraint to inherit. Such a discrepancy can arise when the actual for a formal type with unknown discriminants is a similar private type whose full view has discriminants. (Analyze_Object_Declaration): If restriction No_Streams is set, then do not permit objects to be declared of a stream type, or of a composite type containing a stream. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90906 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch7.adb')
-rw-r--r--gcc/ada/exp_ch7.adb76
1 files changed, 6 insertions, 70 deletions
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index eb6abd02f34..0339479b0e2 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -1050,77 +1050,13 @@ package body Exp_Ch7 is
if No (Wrap_Node) then
null;
- elsif Nkind (Wrap_Node) = N_Iteration_Scheme then
-
- -- Create a declaration followed by an assignment, so that
- -- the assignment can have its own transient scope.
- -- We generate the equivalent of:
-
- -- type Ptr is access all expr_type;
- -- Var : Ptr;
- -- begin
- -- Var := Expr'reference;
- -- end;
-
- -- This closely resembles what is done in Remove_Side_Effect,
- -- but it has to be done here, before the analysis of the call
- -- is completed.
-
- declare
- Ptr_Typ : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('A'));
- Ptr : constant Entity_Id :=
- Make_Defining_Identifier (Loc,
- Chars => New_Internal_Name ('T'));
-
- Expr_Type : constant Entity_Id := Etype (N);
- New_Expr : constant Node_Id := Relocate_Node (N);
- Decl : Node_Id;
- Ptr_Typ_Decl : Node_Id;
- Stmt : Node_Id;
+ -- If the node to wrap is an iteration_scheme, the expression is
+ -- one of the bounds, and the expansion will make an explicit
+ -- declaration for it (see Analyze_Iteration_Scheme, sem_ch5.adb),
+ -- so do not apply any transformations here.
- begin
- Ptr_Typ_Decl :=
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Ptr_Typ,
- Type_Definition =>
- Make_Access_To_Object_Definition (Loc,
- All_Present => True,
- Subtype_Indication =>
- New_Reference_To (Expr_Type, Loc)));
-
- Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Ptr,
- Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc));
-
- Set_Etype (Ptr, Ptr_Typ);
- Stmt :=
- Make_Assignment_Statement (Loc,
- Name => New_Occurrence_Of (Ptr, Loc),
- Expression => Make_Reference (Loc, New_Expr));
-
- Set_Analyzed (New_Expr, False);
-
- Insert_List_Before_And_Analyze
- (Parent (Wrap_Node),
- New_List (
- Ptr_Typ_Decl,
- Decl,
- Make_Block_Statement (Loc,
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- New_List (Stmt)))));
-
- Rewrite (N,
- Make_Explicit_Dereference (Loc,
- Prefix => New_Reference_To (Ptr, Loc)));
- Analyze_And_Resolve (N, Expr_Type);
-
- end;
-
- -- Transient scope is required
+ elsif Nkind (Wrap_Node) = N_Iteration_Scheme then
+ null;
else
New_Scope (New_Internal_Entity (E_Block, Current_Scope, Loc, 'B'));
OpenPOWER on IntegriCloud