|| sym->attr.allocatable)
&& !DECL_ARTIFICIAL (decl))
{
- 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.",
- sym->name, &sym->declared_at);
+ 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.",
+ sym->name, &sym->declared_at);
TREE_STATIC (decl) = 1;