diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-07-06 14:37:54 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-07-06 14:37:54 +0200 |
commit | 937e96763e42c48c29e3a5edf2eea3fb2c59fb27 (patch) | |
tree | e06e4ba4a6b2f4134dd131533a73bc7e185a6ac6 /gcc/ada/exp_ch6.adb | |
parent | 75e4e36dfe12f78efa61c071caf95ba9d5f4f722 (diff) | |
download | gcc-937e96763e42c48c29e3a5edf2eea3fb2c59fb27.zip gcc-937e96763e42c48c29e3a5edf2eea3fb2c59fb27.tar.gz gcc-937e96763e42c48c29e3a5edf2eea3fb2c59fb27.tar.bz2 |
[multiple changes]
2016-07-06 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.adb Flag252 is now used as Is_Finalized_Transient. Flag295
is now used as Is_Ignored_Transient.
(Is_Finalized_Transient): New routine.
(Is_Ignored_Transient): New routine.
(Is_Processed_Transient): Removed.
(Set_Is_Finalized_Transient): New routine.
(Set_Is_Ignored_Transient): New routine.
(Set_Is_Processed_Transient): Removed.
(Write_Entity_Flags): Output Flag252 and Flag295.
* einfo.ads: New attributes Is_Finalized_Transient
and Is_Ignored_Transient along with occurrences in
entities. Remove attribute Is_Processed_Transient.
(Is_Finalized_Transient): New routine along with pragma Inline.
(Is_Ignored_Transient): New routine along with pragma Inline.
(Is_Processed_Transient): Removed along with pragma Inline.
(Set_Is_Finalized_Transient): New routine along with pragma Inline.
(Set_Is_Ignored_Transient): New routine along with pragma Inline.
(Set_Is_Processed_Transient): Removed along with pragma Inline.
* exp_aggr.adb Add with and use clauses for Exp_Ch11 and Inline.
(Build_Record_Aggr_Code): Change the handling
of controlled record components.
(Ctrl_Init_Expression): Removed.
(Gen_Assign): Add new formal parameter In_Loop
along with comment on usage. Remove local variables Stmt and
Stmt_Expr. Change the handling of controlled array components.
(Gen_Loop): Update the call to Gen_Assign.
(Gen_While): Update the call to Gen_Assign.
(Initialize_Array_Component): New routine.
(Initialize_Ctrl_Array_Component): New routine.
(Initialize_Ctrl_Record_Component): New routine.
(Initialize_Record_Component): New routine.
(Process_Transient_Component): New routine.
(Process_Transient_Component_Completion): New routine.
* exp_ch4.adb (Process_Transient_In_Expression): New routine.
(Process_Transient_Object): Removed. Replace all existing calls
to this routine with calls to Process_Transient_In_Expression.
* exp_ch6.adb (Expand_Ctrl_Function_Call): Remove local constant
Is_Elem_Ref. Update the comment on ignoring transients.
* exp_ch7.adb (Process_Declarations): Do not process ignored
or finalized transient objects.
(Process_Transient_In_Scope): New routine.
(Process_Transients_In_Scope): New routine.
(Process_Transient_Objects): Removed. Replace all existing calls
to this routine with calls to Process_Transients_In_Scope.
* exp_util.adb (Build_Transient_Object_Statements): New routine.
(Is_Finalizable_Transient): Do not consider a transient object
which has been finalized.
(Requires_Cleanup_Actions): Do not consider ignored or finalized
transient objects.
* exp_util.ads (Build_Transient_Object_Statements): New routine.
* sem_aggr.adb: Major code clean up.
* sem_res.adb: Update documentation.
2016-07-06 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Analyze_Subtype_Declaration): For generated
subtypes, such as actual subtypes of unconstrained formals,
inherit predicate functions, if any, from the parent type rather
than creating redundant new ones.
From-SVN: r238044
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index cc59353..938484b 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -4115,10 +4115,6 @@ package body Exp_Ch6 is and then Present (Generalized_Indexing (Ref)); end Is_Element_Reference; - -- Local variables - - Is_Elem_Ref : constant Boolean := Is_Element_Reference (N); - -- Start of processing for Expand_Ctrl_Function_Call begin @@ -4142,20 +4138,24 @@ package body Exp_Ch6 is Remove_Side_Effects (N); - -- When the temporary function result appears inside a case expression - -- or an if expression, its lifetime must be extended to match that of - -- the context. If not, the function result will be finalized too early - -- and the evaluation of the expression could yield incorrect result. An - -- exception to this rule are references to Ada 2012 container elements. + -- The side effect removal of the function call produced a temporary. + -- When the context is a case expression, if expression, or expression + -- with actions, the lifetime of the temporary must be extended to match + -- that of the context. Otherwise the function result will be finalized + -- too early and affect the result of the expression. To prevent this + -- unwanted effect, the temporary should not be considered for clean up + -- actions by the general finalization machinery. + + -- Exception to this rule are references to Ada 2012 container elements. -- Such references must be finalized at the end of each iteration of the -- related quantified expression, otherwise the container will remain -- busy. - if not Is_Elem_Ref + if Nkind (N) = N_Explicit_Dereference and then Within_Case_Or_If_Expression (N) - and then Nkind (N) = N_Explicit_Dereference + and then not Is_Element_Reference (N) then - Set_Is_Processed_Transient (Entity (Prefix (N))); + Set_Is_Ignored_Transient (Entity (Prefix (N))); end if; end Expand_Ctrl_Function_Call; |