[Bug fortran/34053] -frecursive: No need to use the stack for local variables of the main program
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon May 25 23:02:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list