diff options
author | Asher Langton <langton2@llnl.gov> | 2007-08-26 18:48:10 +0000 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-08-26 20:48:10 +0200 |
commit | 1e7de83b4052b6def0c3feb99d3a5ddfeb6baf51 (patch) | |
tree | 1c85b96984255178e65742ce067ee7df205f45a4 /gcc/fortran/options.c | |
parent | 7b89fb3c289c42d6963933a055305088d5d454e7 (diff) | |
download | gcc-1e7de83b4052b6def0c3feb99d3a5ddfeb6baf51.zip gcc-1e7de83b4052b6def0c3feb99d3a5ddfeb6baf51.tar.gz gcc-1e7de83b4052b6def0c3feb99d3a5ddfeb6baf51.tar.bz2 |
gfortran.h (gfc_option_t): Add flag_recursive.
2007-08-26 Asher Langton <langton2@llnl.gov>
Tobias Burnus <burnus@net-b.de>
* gfortran.h (gfc_option_t): Add flag_recursive.
* lang.opt: Add -frecursive option and update -fopenmp.
* invoke.texi (-frecursive): Document new option.
(-fopenmp,-fno-automatic,-fmax-stack-var-size): Update.
* options.c (gfc_init_options, gfc_post_options,
gfc_handle_option): Add -frecursive and modify -fopenmp.
(gfc_post_options): Add warning for conflicting flags.
2007-08-26 Asher Langton <langton2@llnl.gov>
* gfortran.dg/recursive_stack.f90: New.
* gfortran.dg/openmp_stack.f90: New.
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
From-SVN: r127813
Diffstat (limited to 'gcc/fortran/options.c')
-rw-r--r-- | gcc/fortran/options.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 0bea67d..3ab7362 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -86,7 +86,10 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, gfc_option.flag_f2c = 0; gfc_option.flag_second_underscore = -1; gfc_option.flag_implicit_none = 0; - gfc_option.flag_max_stack_var_size = 32768; + + /* 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_range_check = 1; gfc_option.flag_pack_derived = 0; gfc_option.flag_repack_arrays = 0; @@ -103,6 +106,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED, gfc_option.flag_d_lines = -1; gfc_option.flag_openmp = 0; gfc_option.flag_sign_zero = 1; + gfc_option.flag_recursive = 0; gfc_option.fpe = 0; @@ -290,6 +294,37 @@ gfc_post_options (const char **pfilename) if (gfc_option.flag_second_underscore == -1) gfc_option.flag_second_underscore = gfc_option.flag_f2c; + if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2 + && gfc_option.flag_max_stack_var_size != 0) + gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d", + gfc_option.flag_max_stack_var_size); + else if (!gfc_option.flag_automatic && gfc_option.flag_recursive) + gfc_warning_now ("Flag -fno-automatic overwrites -frecursive"); + else if (!gfc_option.flag_automatic && gfc_option.flag_openmp) + gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by " + "-fopenmp"); + else if (gfc_option.flag_max_stack_var_size != -2 + && gfc_option.flag_recursive) + gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d", + gfc_option.flag_max_stack_var_size); + else if (gfc_option.flag_max_stack_var_size != -2 + && gfc_option.flag_openmp) + gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive " + "implied by -fopenmp", + gfc_option.flag_max_stack_var_size); + + /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */ + if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp) + gfc_option.flag_max_stack_var_size = -1; + + /* Set default. */ + if (gfc_option.flag_max_stack_var_size == -2) + gfc_option.flag_max_stack_var_size = 32768; + + /* Implement -frecursive as -fmax-stack-var-size=-1. */ + if (gfc_option.flag_recursive) + gfc_option.flag_max_stack_var_size = -1; + /* Implement -fno-automatic as -fmax-stack-var-size=0. */ if (!gfc_option.flag_automatic) gfc_option.flag_max_stack_var_size = 0; @@ -698,6 +733,11 @@ gfc_handle_option (size_t scode, const char *arg, int value) MAX_SUBRECORD_LENGTH); gfc_option.max_subrecord_length = value; + break; + + case OPT_frecursive: + gfc_option.flag_recursive = 1; + break; } return result; |