diff options
author | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2017-09-29 15:33:23 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2017-09-29 15:33:23 +0000 |
commit | cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6 (patch) | |
tree | 5b626698ecdaf41e2a8f95028be8c76b863eaed6 /gcc/ada/exp_ch6.adb | |
parent | e75210d645630f12bf149043cf6ae51829f5ed78 (diff) | |
download | gcc-cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6.zip gcc-cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6.tar.gz gcc-cd644ae2bc0ce62b88f786ce5a68ad0ba2509ec6.tar.bz2 |
[multiple changes]
2017-09-29 Bob Duff <duff@adacore.com>
* exp_ch6.adb (Expand_Call_Helper): Replace with code more similar to
what we had before.
(Make_Build_In_Place_Call_In_Object_Declaration): Back out previous
change. Set the Etype in the class-wide case. This fixes a regression
in the libadalang test suite.
2017-09-29 Joel Brobecker <brobecker@adacore.com>
* doc/gnat_ugn/building_executable_programs_with_gnat.rst,
doc/gnat_ugn/the_gnat_compilation_model.rst: Avoid use of single colon
in comment markup.
* gnat_ugn.texi: Regenerate.
2017-09-29 Justin Squirek <squirek@adacore.com>
* ali-util.adb, comperr.adb, cprint.adb, errout.adb, fmap.adb,
fname-sf.adb, frontend.adb, lib-xref-spark_specific.adb, gnat1drv.adb,
gnatls.adb, lib.adb, lib-load.adb, lib-writ.adb, prepcomp.adb,
sinput-d.adb, sinput-l.adb, sprint.adb, targparm.adb: Update comparison
for checking source file status and error message and/or call to
Read_Source_File.
* libgnat/s-os_lib.ads: Add new potential value constant for
uninitialized file descriptors.
* osint.adb, osint.ads (Read_Source_File): Add extra parameter to
return result of IO to encompass a read access failure in addition to a
file-not-found error.
From-SVN: r253294
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 5fcd1f5..715e74c 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -4330,11 +4330,19 @@ package body Exp_Ch6 is -- result from the secondary stack. if Needs_Finalization (Etype (Subp)) then + if not Is_Build_In_Place_Function_Call (Call_Node) + and then + (No (First_Formal (Subp)) + or else + not Is_Concurrent_Record_Type (Etype (First_Formal (Subp)))) + then + Expand_Ctrl_Function_Call (Call_Node); + -- Build-in-place function calls which appear in anonymous contexts -- need a transient scope to ensure the proper finalization of the -- intermediate result after its use. - if Is_Build_In_Place_Function_Call (Call_Node) + elsif Is_Build_In_Place_Function_Call (Call_Node) and then Nkind_In (Parent (Unqual_Conv (Call_Node)), N_Attribute_Reference, @@ -4346,14 +4354,6 @@ package body Exp_Ch6 is N_Slice) then Establish_Transient_Scope (Call_Node, Sec_Stack => True); - - elsif not Is_Build_In_Place_Function_Call (Call_Node) - and then - (No (First_Formal (Subp)) - or else - not Is_Concurrent_Record_Type (Etype (First_Formal (Subp)))) - then - Expand_Ctrl_Function_Call (Call_Node); end if; end if; end Expand_Call_Helper; @@ -6393,9 +6393,9 @@ package body Exp_Ch6 is end if; end if; - -- For the case of a simple return that does not come from an extended - -- return, in the case of build-in-place, we rewrite "return - -- <expression>;" to be: + -- For the case of a simple return that does not come from an + -- extended return, in the case of build-in-place, we rewrite + -- "return <expression>;" to be: -- return _anon_ : <return_subtype> := <expression> @@ -8518,6 +8518,18 @@ package body Exp_Ch6 is (Obj_Decl, Original_Node (Obj_Decl)); end if; end; + + -- If the object entity has a class-wide Etype, then we need to change + -- it to the result subtype of the function call, because otherwise the + -- object will be class-wide without an explicit initialization and + -- won't be allocated properly by the back end. It seems unclean to make + -- such a revision to the type at this point, and we should try to + -- improve this treatment when build-in-place functions with class-wide + -- results are implemented. ??? + + if Is_Class_Wide_Type (Etype (Defining_Identifier (Obj_Decl))) then + Set_Etype (Defining_Identifier (Obj_Decl), Result_Subt); + end if; end Make_Build_In_Place_Call_In_Object_Declaration; ------------------------------------------------- |