diff options
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 784f7b6..bed61e2 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -743,8 +743,10 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) /* Keep variables larger than max-stack-var-size off stack. */ if (!(sym->ns->proc_name && sym->ns->proc_name->attr.recursive) + && !(sym->ns->proc_name && sym->ns->proc_name->attr.is_main_program) && !sym->attr.automatic && sym->attr.save != SAVE_EXPLICIT + && sym->attr.save != SAVE_IMPLICIT && INTEGER_CST_P (DECL_SIZE_UNIT (decl)) && !gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl)) /* Put variable length auto array pointers always into stack. */ @@ -757,13 +759,17 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) { if (flag_max_stack_var_size > 0) gfc_warning (OPT_Wsurprising, - "Array %qs at %L is larger than limit set by" - " %<-fmax-stack-var-size=%>, moved from stack to static" - " storage. This makes the procedure unsafe when called" - " recursively, or concurrently from multiple threads." - " Consider using %<-frecursive%>, or increase the" - " %<-fmax-stack-var-size=%> limit, or change the code to" - " use an ALLOCATABLE array.", + "Array %qs at %L is larger than limit set by " + "%<-fmax-stack-var-size=%>, moved from stack to static " + "storage. This makes the procedure unsafe when called " + "recursively, or concurrently from multiple threads. " + "Consider increasing the %<-fmax-stack-var-size=%> " + "limit (or use %<-frecursive%>, which implies " + "unlimited %<-fmax-stack-var-size%>) - or change the " + "code to use an ALLOCATABLE array. If the variable is " + "never accessed concurrently, this warning can be " + "ignored, and the variable could also be declared with " + "the SAVE attribute.", sym->name, &sym->declared_at); TREE_STATIC (decl) = 1; |