summaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-19 23:05:49 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-19 23:05:49 +0000
commit873f242d97571e98acad8ea1912f81682bd7a448 (patch)
tree9afc547179607fb347353c4d0ce3bb267874eed5 /gcc/fortran/trans-decl.c
parent596c1e80f8f07bb3e0444befe6fbc4f12ffca7e6 (diff)
downloadgcc-873f242d97571e98acad8ea1912f81682bd7a448.tar.gz
2012-12-19 Tobias Burnus <burnus@net-b.de>
PR fortran/55733 * trans-decl.c (gfc_create_string_length): Avoid setting TREE_STATIC for automatic variables with -fno-automatic. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 3202840cb14..588f55a02df 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1089,9 +1089,15 @@ gfc_create_string_length (gfc_symbol * sym)
tree length;
const char *name;
+ /* The string length variable shall be in static memory if it is either
+ explicitly SAVED, a module variable or with -fno-automatic. Only
+ relevant is "len=:" - otherwise, it is either a constant length or
+ it is an automatic variable. */
bool static_length = sym->attr.save
|| sym->ns->proc_name->attr.flavor == FL_MODULE
- || gfc_option.flag_max_stack_var_size == 0;
+ || (gfc_option.flag_max_stack_var_size == 0
+ && sym->ts.deferred && !sym->attr.dummy
+ && !sym->attr.result && !sym->attr.function);
/* Also prefix the mangled name. We need to call GFC_PREFIX for static
variables as some systems do not support the "." in the assembler name.