From 2d8c9ad5c96e9a66b11deedb894822143202392e Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sat, 14 May 2011 11:39:38 +0200 Subject: [PATCH] invoke.texi (-Ofast): Also enables -fstack-arrays. 2011-05-14 Tobias Burnus * doc/invoke.texi (-Ofast): Also enables -fstack-arrays. 2011-05-14 Tobias Burnus * options.c (gfc_init_options, gfc_post_options): Enable -fstack-arrays by default if -Ofast is used. * invoke.texi (-fstack-arrays): Document this. From-SVN: r173751 --- gcc/ChangeLog | 4 ++++ gcc/doc/invoke.texi | 2 +- gcc/fortran/ChangeLog | 32 +++++++++++++++++++------------- gcc/fortran/invoke.texi | 4 +++- gcc/fortran/options.c | 5 ++++- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef89e7a17d5..8b383030924 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2011-05-14 Tobias Burnus + + * doc/invoke.texi (-Ofast): Also enables -fstack-arrays. + 2011-05-13 Martin Jambor * ipa-prop.c (ipa_cst_from_jfunc): New function. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index aee1e6b1fc3..6ed289e3b15 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6000,7 +6000,7 @@ Disregard strict standards compliance. @option{-Ofast} enables all @option{-O3} optimizations. It also enables optimizations that are not valid for all standard compliant programs. It turns on @option{-ffast-math} and the Fortran-specific -@option{-fno-protect-parens}. +@option{-fno-protect-parens} and @option{-fstack-arrays}. If you use multiple @option{-O} options, with or without level numbers, the last such option is the one that is effective. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index afc553384ad..b4168316436 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,21 +1,27 @@ +2011-05-14 Tobias Burnus + + * options.c (gfc_init_options, gfc_post_options): Enable + -fstack-arrays by default if -Ofast is used. + * invoke.texi (-fstack-arrays): Document this. + 2011-05-14 Janne Blomqvist - PR libfortran/48915 - * gfortran.h (gfc_option_t): Remove flag_dump_core. - * gfortran.texi (GFORTRAN_ERROR_DUMPCORE): Remove section. - (GFORTRAN_ERROR_BACKTRACE): Document that it's enabled by default. - * intrinsic.texi (ABORT): Remove explanation of -fdump-core. - * invoke.texi: Remove -fdump-core, document that -fbacktrace is - enabled by default. - * lang.opt: Remove -fdump-core. - * options.c (gfc_init_options): Make backtrace default to enabled, - remove dump_core. - (gfc_handle_option): Remove OPT_fdump-core. - * trans-decl.c: Pass a 0 to preserve ABI. + PR libfortran/48915 + * gfortran.h (gfc_option_t): Remove flag_dump_core. + * gfortran.texi (GFORTRAN_ERROR_DUMPCORE): Remove section. + (GFORTRAN_ERROR_BACKTRACE): Document that it's enabled by default. + * intrinsic.texi (ABORT): Remove explanation of -fdump-core. + * invoke.texi: Remove -fdump-core, document that -fbacktrace is + enabled by default. + * lang.opt: Remove -fdump-core. + * options.c (gfc_init_options): Make backtrace default to enabled, + remove dump_core. + (gfc_handle_option): Remove OPT_fdump-core. + * trans-decl.c: Pass a 0 to preserve ABI. 2011-05-14 Janne Blomqvist - * gfortran.texi: Remove GFORTRAN_USE_STDERR documentation. + * gfortran.texi: Remove GFORTRAN_USE_STDERR documentation. 2011-05-13 Tobias Burnus diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index f68b18c6776..ab45072efad 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -1381,7 +1381,9 @@ The default value for @var{n} is 32768. Adding this option will make the fortran compiler put all local arrays, even those of unknown size onto stack memory. If your program uses very large local arrays it's possible that you'll have to extend your runtime -limits for stack memory on some operating systems. +limits for stack memory on some operating systems. This flag is enabled +by default at optimization level @option{-Ofast}. + @item -fpack-derived @opindex @code{fpack-derived} diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index d4778ba7b1e..920b95f33fe 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -125,7 +125,7 @@ gfc_init_options (unsigned int decoded_options_count, /* Default value of flag_max_stack_var_size is set in gfc_post_options. */ gfc_option.flag_max_stack_var_size = -2; - gfc_option.flag_stack_arrays = 0; + gfc_option.flag_stack_arrays = -1; gfc_option.flag_range_check = 1; gfc_option.flag_pack_derived = 0; @@ -274,6 +274,9 @@ gfc_post_options (const char **pfilename) if (gfc_option.flag_protect_parens == -1) gfc_option.flag_protect_parens = !optimize_fast; + if (gfc_option.flag_stack_arrays == -1) + gfc_option.flag_stack_arrays = optimize_fast; + /* By default, disable (re)allocation during assignment for -std=f95, and enable it for F2003/F2008/GNU/Legacy. */ if (gfc_option.flag_realloc_lhs == -1) -- 2.30.2