diff mbox

[Ada] Fix bogus return value for function with In Out parameter

Message ID 3250168.2U2VWOoQtk@polaris
State New
Headers show

Commit Message

Eric Botcazou Sept. 18, 2013, 10:25 a.m. UTC
This fixes an oversight in the recent implementation of functions with In Out 
parameters for Ada 2012, which leads to wrong code if the function contains a 
nested subprogram which also takes an In Out parameter with elementary type.

Tested on x86_64-suse-linux, applied on all active branches.


2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Pop the stack of
	return variables for subprograms using the CICO mechanism.


2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/in_out_parameter4.adb: New test.
diff mbox

Patch

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 202681)
+++ gcc-interface/trans.c	(working copy)
@@ -3605,6 +3605,8 @@  Subprogram_Body_to_gnu (Node_Id gnat_nod
     {
       tree gnu_retval;
 
+      gnu_return_var_stack->pop ();
+
       add_stmt (gnu_result);
       add_stmt (build1 (LABEL_EXPR, void_type_node,
 			gnu_return_label_stack->last ()));