public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7901] ada: Elide the copy in extended returns for nonlimited by-reference types
@ 2023-09-27 8:28 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27 8:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2d0caa03cb6f7a5480e6540c1dfd7b0f2e267960
commit r13-7901-g2d0caa03cb6f7a5480e6540c1dfd7b0f2e267960
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Tue Jul 11 10:59:17 2023 +0200
ada: Elide the copy in extended returns for nonlimited by-reference types
gcc/ada/
* gcc-interface/trans.cc (gnat_to_gnu): Restrict previous change to
the case where the simple return statement has got no storage pool.
Diff:
---
gcc/ada/gcc-interface/trans.cc | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index c43af162309..54e0e8a7fbd 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -8478,8 +8478,8 @@ gnat_to_gnu (Node_Id gnat_node)
5. If this is a reference to an unconstrained array which is used either
as the prefix of an attribute reference that requires an lvalue or in
- a return statement, then return the result unmodified because we want
- to return the original bounds.
+ a return statement without storage pool, return the result unmodified
+ because we want to return the original bounds.
6. Finally, if the type of the result is already correct. */
@@ -8545,7 +8545,8 @@ gnat_to_gnu (Node_Id gnat_node)
&& Present (Parent (gnat_node))
&& ((Nkind (Parent (gnat_node)) == N_Attribute_Reference
&& lvalue_required_for_attribute_p (Parent (gnat_node)))
- || Nkind (Parent (gnat_node)) == N_Simple_Return_Statement))
+ || (Nkind (Parent (gnat_node)) == N_Simple_Return_Statement
+ && No (Storage_Pool (gnat_node)))))
;
else if (TREE_TYPE (gnu_result) != gnu_result_type)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-27 8:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 8:28 [gcc r13-7901] ada: Elide the copy in extended returns for nonlimited by-reference types Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).