From bba1fdebcc8cf29e09499f2921820000f5070f31 Mon Sep 17 00:00:00 2001
From: Bob Dubner <rdubner@symas.com>
Date: Sun, 7 Apr 2024 08:52:33 -0400
Subject: [PATCH] Temporarily repair the "return address of local" problem.

---
 gcc/cobol/genapi.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 372315b3cc8a..bdd16530de9c 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -5124,10 +5124,15 @@ parser_exit(void)
       // The byte array to be returned is in returning, which is a local
       // variable on the stack.  We need to make a copy of it to avoid the
       // error of returning a pointer to data on the stack.
+      
+      // Create a buffer that grows in size, as needed, to accommodate the
+      // data that needs to be returned.
+      
+#pragma warning "Fix me"
 
       tree array_type = build_array_type_nelts(UCHAR,
                                     current_function->returning->data.capacity);
-      tree retval     =  gg_define_variable(array_type, vs_stack);
+      tree retval     =  gg_define_variable(array_type, vs_static);
       gg_memcpy(gg_get_address_of(retval),
                 member(current_function->returning->var_decl_node, "data"),
                 member(current_function->returning->var_decl_node, "capacity"));
-- 
GitLab