[COMMITTED] ada: Call idiomatic routine in Expand_Simple_Function_Return

Message ID 20230529082953.2411190-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Call idiomatic routine in Expand_Simple_Function_Return |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès May 29, 2023, 8:29 a.m. UTC
  From: Eric Botcazou <ebotcazou@adacore.com>

In the primary stack case, Insert_Actions is invoked when the expression is
being rewritten, whereas Insert_List_Before_And_Analyze is invoked in the
secondary stack case.  The former is idiomatic, the latter is not.

gcc/ada/

	* exp_ch6.adb (Expand_Simple_Function_Return): Call Insert_Actions
	consistently when rewriting the expression.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch6.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 87560462315..b19db8fb74d 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -6895,7 +6895,7 @@  package body Exp_Ch6 is
 
                Temp := Make_Temporary (Loc, 'R', Alloc_Node);
 
-               Insert_List_Before_And_Analyze (N, New_List (
+               Insert_Actions (Exp, New_List (
                  Make_Full_Type_Declaration (Loc,
                    Defining_Identifier => Acc_Typ,
                    Type_Definition     =>