+2014-01-21 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch5.adb: Fix comment.
+ * switch-c.adb: Minor comment update.
+ * exp_ch3.adb: Minor reformatting.
+
+2014-01-21 Arnaud Charlet <charlet@adacore.com>
+
+ * back_end.adb (Scan_Compiler_Arguments): Do not store object
+ filename in gnatprove mode.
+
+2014-01-21 Thomas Quinot <quinot@adacore.com>
+
+ * sinfo.ads (No_Ctrl_Actions): Clarify documentation (flag also
+ suppresses usage of primitive _assign for tagged types).
+ * exp_aggr.adb (Build_Array_Aggr_Code.Gen_Assign): Set
+ No_Ctrl_Actions for a tagged type that does not require
+ finalization, as we want to disable usage of _assign (which
+ may cause undesirable discriminant checks on an uninitialized,
+ invalid target).
+
+2014-01-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb: Reject invariant'class on completion.
+
2014-01-21 Javier Miranda <miranda@adacore.com>
* exp_ch3.adb (Build_Init_Procedure): For
end if;
else
- -- Now generate the assignment with no associated controlled
- -- actions since the target of the assignment may not have been
- -- initialized, it is not possible to Finalize it as expected by
- -- normal controlled assignment. The rest of the controlled
- -- actions are done manually with the proper finalization list
- -- coming from the context.
-
A :=
Make_OK_Assignment_Statement (Loc,
Name => Indexed_Comp,
Expression => New_Copy_Tree (Expr));
- if Present (Comp_Type) and then Needs_Finalization (Comp_Type) then
- Set_No_Ctrl_Actions (A);
+ -- The target of the assignment may not have been initialized,
+ -- so it is not possible to call Finalize as expected in normal
+ -- controlled assignments. We must also avoid using the primitive
+ -- _assign (which depends on a valid target, and may for example
+ -- perform discriminant checks on it).
- -- If this is an aggregate for an array of arrays, each
- -- sub-aggregate will be expanded as well, and even with
- -- No_Ctrl_Actions the assignments of inner components will
- -- require attachment in their assignments to temporaries.
- -- These temporaries must be finalized for each subaggregate,
- -- to prevent multiple attachments of the same temporary
- -- location to same finalization chain (and consequently
- -- circular lists). To ensure that finalization takes place
- -- for each subaggregate we wrap the assignment in a block.
+ -- Both Finalize and usage of _assign are disabled by setting
+ -- No_Ctrl_Actions on the assignment. The rest of the controlled
+ -- actions are done manually with the proper finalization list
+ -- coming from the context.
- if Is_Array_Type (Comp_Type)
- and then Nkind (Expr) = N_Aggregate
- then
- A :=
- Make_Block_Statement (Loc,
+ Set_No_Ctrl_Actions (A);
+
+ -- If this is an aggregate for an array of arrays, each
+ -- sub-aggregate will be expanded as well, and even with
+ -- No_Ctrl_Actions the assignments of inner components will
+ -- require attachment in their assignments to temporaries. These
+ -- temporaries must be finalized for each subaggregate, to prevent
+ -- multiple attachments of the same temporary location to same
+ -- finalization chain (and consequently circular lists). To ensure
+ -- that finalization takes place for each subaggregate we wrap the
+ -- assignment in a block.
+
+ if Present (Comp_Type)
+ and then Needs_Finalization (Comp_Type)
+ and then Is_Array_Type (Comp_Type)
+ and then Present (Expr)
+ then
+ A := Make_Block_Statement (Loc,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (A)));
- end if;
end if;
Append_To (L, A);
-- Adjust the tag if tagged (because of possible view
- -- conversions), unless compiling for a VM where
- -- tags are implicit.
+ -- conversions), unless compiling for a VM where tags
+ -- are implicit.
if Present (Comp_Type)
and then Is_Tagged_Type (Comp_Type)
Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
Set_Assignment_OK (Ref);
- -- Make the assignment without usual controlled actions since
- -- we only want the post adjust but not the pre finalize here
- -- Add manual adjust when necessary.
+ -- Make the assignment without usual controlled actions, since
+ -- we only want to Adjust afterwards, but not to Finalize
+ -- beforehand. Add manual Adjust when necessary.
Assign := New_List (
Make_OK_Assignment_Statement (Loc,
end if;
end;
- -- Generate assignments of hidden assignments. If the base type is an
- -- unchecked union, the discriminants are unknown to the back-end and
- -- absent from a value of the type, so assignments for them are not
- -- emitted.
+ -- Generate assignments of hidden discriminants. If the base type is
+ -- an unchecked union, the discriminants are unknown to the back-end
+ -- and absent from a value of the type, so assignments for them are
+ -- not emitted.
if Has_Discriminants (Typ)
and then not Is_Unchecked_Union (Base_Type (Typ))