This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
max-stack-var-size
- From: canqun at nudt dot edu dot cn
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Thu, 6 Nov 2003 22:18:19 +0800 (HKT)
- Subject: max-stack-var-size
- Reply-to: canqun at nudt dot edu dot cn
The Fortran 95 compiler option '-fmax-stack-var-size'
can hardly take effect. Itonly controls the temporaries
generated by the compiler. This patch fixes the problem.
It is better to set the default size limit of stack
variables to a positive value, otherwise programs with
larg data set fail to execute after compiled by
gfortran due to stack limit. The default stack limit on
Linux is just 8192 Kbytes.
Index: ChangeLog
========================================================
===========
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/ChangeLog,v
retrieving revision 1.1.2.69
diff -c -3 -p -r1.1.2.69 ChangeLog
*** ChangeLog 2 Nov 2003 00:51:02 -0000 1.1.2.69
--- ChangeLog 6 Nov 2003 12:20:52 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2003-11-06 Canqun Yang <canqun@nudt.edu.cn>
+
+ * options.c (gfc_init_options): Set
flag_max_stack_var_size as 32768.
+ * trans-decl.c (gfc_finish_var_decl):
Modified.
2003-11-02 Canqun Yang <canqun@nudt.edu.cn>
Index: options.c
========================================================
===========
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/options.c,v
retrieving revision 1.1.2.4
diff -c -3 -p -r1.1.2.4 options.c
*** options.c 10 Aug 2003 13:52:31 -0000 1.1.2.4
--- options.c 6 Nov 2003 12:20:52 -0000
*************** gfc_init_options (unsigned int argc ATTR
*** 61,67 ****
gfc_option.flag_underscoring = 1;
gfc_option.flag_second_underscore = 1;
gfc_option.flag_implicit_none = 0;
! gfc_option.flag_max_stack_var_size = -1;
gfc_option.flag_module_access_private = 0;
gfc_option.flag_no_backend = 0;
gfc_option.flag_pack_derived = 0;
--- 61,67 ----
gfc_option.flag_underscoring = 1;
gfc_option.flag_second_underscore = 1;
gfc_option.flag_implicit_none = 0;
! gfc_option.flag_max_stack_var_size = 32768;
gfc_option.flag_module_access_private = 0;
gfc_option.flag_no_backend = 0;
gfc_option.flag_pack_derived = 0;
Index: trans-decl.c
========================================================
===========
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/trans-decl.c,v
retrieving revision 1.1.2.16
diff -c -3 -p -r1.1.2.16 trans-decl.c
*** trans-decl.c 13 Oct 2003 23:32:28 -0000 1.1.2.16
--- trans-decl.c 6 Nov 2003 12:20:59 -0000
*************** gfc_finish_var_decl (tree decl, gfc_symb
*** 416,421 ****
--- 416,425 ----
if ((sym->attr.save || sym->attr.data || sym->value)
&& !sym->attr.use_assoc)
TREE_STATIC (decl) = 1;
+
+ /* Keep variables larger than max-stack-var-size
off stack. */
+ if (gfc_can_put_var_on_stack (DECL_SIZE_UNIT
(decl)) == 0)
+ TREE_STATIC (decl) = 1;
}