+2019-08-11 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/91413
+ * invoke.texi (-fmax-stack-var-size): Document increased default.
+ * options.c (gfc_post_options): Increase default stack var size to
+ 65536 bytes.
+ * trans-decl.c (gfc_finish_var_decl): Generate warning when local
+ array moved to static storage.
+
2019-08-10 Steven G. Kargl <kargl@gcc.gnu.org>
* decl.c (match_old_style_init): Use a clearer error message.
bounds, and may not apply to all character variables.
Future versions of GNU Fortran may improve this behavior.
-The default value for @var{n} is 32768.
+The default value for @var{n} is 65536.
@item -fstack-arrays
@opindex @code{fstack-arrays}
/* Set default. */
if (flag_max_stack_var_size == -2)
- flag_max_stack_var_size = 32768;
+ flag_max_stack_var_size = 65536;
/* Implement -fno-automatic as -fmax-stack-var-size=0. */
if (!flag_automatic)
|| 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);
+
TREE_STATIC (decl) = 1;
/* Because the size of this variable isn't known until now, we may have