This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34053] -frecursive: No need to use the stack for local variables of the main program
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 May 2009 23:02:32 -0000
- Subject: [Bug fortran/34053] -frecursive: No need to use the stack for local variables of the main program
- References: <bug-34053-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from burnus at gcc dot gnu dot org 2009-05-25 23:02 -------
The following should be enough. gfc_can_put_var_on_stack is also called
elsewhere but those calls shouldn't matter so much.
Index: trans-decl.c
===================================================================
--- trans-decl.c (Revision 147558)
+++ trans-decl.c (Arbeitskopie)
@@ -544,10 +544,12 @@
TREE_TYPE (decl) = new_type;
}
- /* Keep variables larger than max-stack-var-size off stack. */
+ /* Keep variables larger than max-stack-var-size off stack and
+ - even with -frecursive - variables of the main program. */
if (!sym->ns->proc_name->attr.recursive
&& INTEGER_CST_P (DECL_SIZE_UNIT (decl))
- && !gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl))
+ && (!gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl))
+ || sym->ns->proc_name->attr.main_program)
/* Put variable length auto array pointers always into stack. */
&& (TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE
|| sym->attr.dimension == 0
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34053