From: Tobias Burnus Date: Tue, 16 Dec 2014 19:24:50 +0000 (+0100) Subject: 2014-12-15 Tobias Burnus X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=203c7ebffdd7042d9b08d303594eaeb9887ff503;p=gcc.git 2014-12-15 Tobias Burnus * lang.opt (fsecond-underscore, frecord-marker=8, * frecord-marker=4, frealloc-lhs, freal-8-real-16, freal-8-real-10, freal-8-real-4, freal-4-real-16, freal-4-real-10, freal-4-real-8, fprotect-parens, fstack-arrays, fmax-stack-var-size=, fmax-subrecord-length=, ffrontend-optimize, ffree-line-length-, ffixed-line-length-, finteger-4-integer-8, fdefault-real-8, fdefault-integer-8, fdefault-double-8): Add Var() and Init(). * gfortran.h (gfc_option_t): Remove moved flags. * options.c (gfc_init_options, gfc_handle_option): Ditto. (gfc_post_options): Update for name change. * decl.c (gfc_match_old_kind_spec, gfc_match_kind_spec): Handle flag-name change. * frontend-passes.c (gfc_run_passes): Ditto. * module.c (use_iso_fortran_env_module): Ditto. * primary.c (match_integer_constant, match_real_constant): * Ditto. * resolve.c (resolve_ordinary_assign): Ditto. * scanner.c (gfc_next_char_literal, load_line): Ditto. * trans-array.c (gfc_trans_allocate_array_storage, gfc_conv_resolve_dependencies, gfc_trans_auto_array_allocation, gfc_conv_ss_startstride): Ditto. * trans-common.c (gfc_sym_mangled_common_id): Ditto. * trans-decl.c (gfc_sym_mangled_function_id, create_main_function): Ditto. * trans-expr.c (gfc_conv_expr_op, gfc_conv_procedure_call, arrayfunc_assign_needs_temporary, gfc_trans_arrayfunc_assign, gfc_trans_assignment_1): Ditto. * trans-stmt.c (gfc_trans_allocate): Ditto. * trans-types.c (gfc_init_kinds): Ditto. From-SVN: r218790 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d0a3ad48bcc..98c5c54c2c7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,34 @@ +2014-12-16 Tobias Burnus + + * lang.opt (fsecond-underscore, frecord-marker=8, frecord-marker=4, + frealloc-lhs, freal-8-real-16, freal-8-real-10, freal-8-real-4, + freal-4-real-16, freal-4-real-10, freal-4-real-8, fprotect-parens, + fstack-arrays, fmax-stack-var-size=, fmax-subrecord-length=, + ffrontend-optimize, ffree-line-length-, ffixed-line-length-, + finteger-4-integer-8, fdefault-real-8, fdefault-integer-8, + fdefault-double-8): Add Var() and Init(). + * gfortran.h (gfc_option_t): Remove moved flags. + * options.c (gfc_init_options, gfc_handle_option): Ditto. + (gfc_post_options): Update for name change. + * decl.c (gfc_match_old_kind_spec, gfc_match_kind_spec): Handle + flag-name change. + * frontend-passes.c (gfc_run_passes): Ditto. + * module.c (use_iso_fortran_env_module): Ditto. + * primary.c (match_integer_constant, match_real_constant): Ditto. + * resolve.c (resolve_ordinary_assign): Ditto. + * scanner.c (gfc_next_char_literal, load_line): Ditto. + * trans-array.c (gfc_trans_allocate_array_storage, + gfc_conv_resolve_dependencies, gfc_trans_auto_array_allocation, + gfc_conv_ss_startstride): Ditto. + * trans-common.c (gfc_sym_mangled_common_id): Ditto. + * trans-decl.c (gfc_sym_mangled_function_id, + create_main_function): Ditto. + * trans-expr.c (gfc_conv_expr_op, gfc_conv_procedure_call, + arrayfunc_assign_needs_temporary, gfc_trans_arrayfunc_assign, + gfc_trans_assignment_1): Ditto. + * trans-stmt.c (gfc_trans_allocate): Ditto. + * trans-types.c (gfc_init_kinds): Ditto. + 2014-12-16 Janus Weil PR fortran/64244 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 28a7aca6638..fe3e60cce01 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -2140,28 +2140,28 @@ gfc_match_old_kind_spec (gfc_typespec *ts) } - if (ts->type == BT_INTEGER && ts->kind == 4 && gfc_option.flag_integer4_kind == 8) + if (ts->type == BT_INTEGER && ts->kind == 4 && flag_integer4_kind == 8) ts->kind = 8; if (ts->type == BT_REAL || ts->type == BT_COMPLEX) { if (ts->kind == 4) { - if (gfc_option.flag_real4_kind == 8) + if (flag_real4_kind == 8) ts->kind = 8; - if (gfc_option.flag_real4_kind == 10) + if (flag_real4_kind == 10) ts->kind = 10; - if (gfc_option.flag_real4_kind == 16) + if (flag_real4_kind == 16) ts->kind = 16; } if (ts->kind == 8) { - if (gfc_option.flag_real8_kind == 4) + if (flag_real8_kind == 4) ts->kind = 4; - if (gfc_option.flag_real8_kind == 10) + if (flag_real8_kind == 10) ts->kind = 10; - if (gfc_option.flag_real8_kind == 16) + if (flag_real8_kind == 16) ts->kind = 16; } } @@ -2311,28 +2311,28 @@ kind_expr: if(m == MATCH_ERROR) gfc_current_locus = where; - if (ts->type == BT_INTEGER && ts->kind == 4 && gfc_option.flag_integer4_kind == 8) + if (ts->type == BT_INTEGER && ts->kind == 4 && flag_integer4_kind == 8) ts->kind = 8; if (ts->type == BT_REAL || ts->type == BT_COMPLEX) { if (ts->kind == 4) { - if (gfc_option.flag_real4_kind == 8) + if (flag_real4_kind == 8) ts->kind = 8; - if (gfc_option.flag_real4_kind == 10) + if (flag_real4_kind == 10) ts->kind = 10; - if (gfc_option.flag_real4_kind == 16) + if (flag_real4_kind == 16) ts->kind = 16; } if (ts->kind == 8) { - if (gfc_option.flag_real8_kind == 4) + if (flag_real8_kind == 4) ts->kind = 4; - if (gfc_option.flag_real8_kind == 10) + if (flag_real8_kind == 10) ts->kind = 10; - if (gfc_option.flag_real8_kind == 16) + if (flag_real8_kind == 16) ts->kind = 16; } } diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 5485cd14761..0e2c2088eaf 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -104,7 +104,7 @@ gfc_run_passes (gfc_namespace *ns) doloop_warn (ns); doloop_list.release (); - if (gfc_option.flag_frontend_optimize) + if (flag_frontend_optimize) { optimize_namespace (ns); optimize_reduction (ns); @@ -376,7 +376,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED, temporary variable to hold the intermediate result, but only if allocation on assignment is active. */ - if ((*e)->rank > 0 && (*e)->shape == NULL && !gfc_option.flag_realloc_lhs) + if ((*e)->rank > 0 && (*e)->shape == NULL && !flag_realloc_lhs) return 0; /* Skip the test for pure functions if -faggressive-function-elimination diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index e0e5838504e..fb0585b35b1 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2426,16 +2426,6 @@ typedef struct { char *module_dir; gfc_source_form source_form; - /* Maximum line lengths in fixed- and free-form source, respectively. - When fixed_line_length or free_line_length are 0, the whole line is used, - regardless of length. - - If the user requests a fixed_line_length <7 then gfc_init_options() - emits a fatal error. */ - int fixed_line_length; - int free_line_length; - /* Maximum number of continuation lines in fixed- and free-form source, - respectively. */ int max_continue_fixed; int max_continue_free; int max_identifier_length; @@ -2445,17 +2435,9 @@ typedef struct int max_errors; int flag_all_intrinsics; - int flag_default_double; - int flag_default_integer; - int flag_default_real; - int flag_integer4_kind; - int flag_real4_kind; - int flag_real8_kind; int flag_dollar_ok; int flag_underscoring; - int flag_second_underscore; int flag_implicit_none; - int flag_max_stack_var_size; int flag_max_array_constructor; int flag_range_check; int flag_pack_derived; @@ -2473,10 +2455,8 @@ typedef struct int gfc_flag_openmp; int gfc_flag_openmp_simd; int flag_sign_zero; - int flag_stack_arrays; int flag_module_private; int flag_recursive; - int flag_init_local_zero; int flag_init_integer; int flag_init_integer_value; int flag_init_real; @@ -2484,10 +2464,7 @@ typedef struct int flag_init_character; char flag_init_character_value; int flag_align_commons; - int flag_protect_parens; - int flag_realloc_lhs; int flag_aggressive_function_elimination; - int flag_frontend_optimize; int fpe; int fpe_summary; @@ -2497,8 +2474,6 @@ typedef struct int warn_std; int allow_std; int convert; - int record_marker; - int max_subrecord_length; } gfc_option_t; diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index c2978174150..78b3d590877 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -410,15 +410,15 @@ Fortran RejectNegative Treat lines with 'D' in column one as comments fdefault-double-8 -Fortran +Fortran Var(flag_default_double) Set the default double precision kind to an 8 byte wide type fdefault-integer-8 -Fortran +Fortran Var(flag_default_integer) Set the default integer kind to an 8 byte wide type fdefault-real-8 -Fortran +Fortran Var(flag_default_real) Set the default real kind to an 8 byte wide type fdollar-ok @@ -454,7 +454,7 @@ Fortran RejectNegative Assume that the source file is fixed form finteger-4-integer-8 -Fortran RejectNegative +Fortran RejectNegative Var(flag_integer4_kind,8) Interpret any INTEGER(4) as an INTEGER(8) fintrinsic-modules-path @@ -466,11 +466,11 @@ Fortran RejectNegative Joined Specify where to find the compiled intrinsic modules ffixed-line-length-none -Fortran RejectNegative +Fortran RejectNegative Var(flag_fixed_line_length,0) Allow arbitrary character line width in fixed mode ffixed-line-length- -Fortran RejectNegative Joined UInteger +Fortran RejectNegative Joined UInteger Var(flag_fixed_line_length) Init(72) -ffixed-line-length- Use n as character line width in fixed mode ffpe-trap= @@ -486,15 +486,15 @@ Fortran RejectNegative Assume that the source file is free form ffree-line-length-none -Fortran RejectNegative +Fortran RejectNegative Var(flag_free_line_length,0) Allow arbitrary character line width in free mode ffree-line-length- -Fortran RejectNegative Joined UInteger +Fortran RejectNegative Joined UInteger Var(flag_free_line_length) Init(132) -ffree-line-length- Use n as character line width in free mode ffrontend-optimize -Fortran +Fortran Var(flag_frontend_optimize) Init(-1) Enable front end optimization fimplicit-none @@ -530,15 +530,15 @@ Fortran RejectNegative Joined UInteger -fmax-identifier-length= Maximum identifier length fmax-subrecord-length= -Fortran RejectNegative Joined UInteger +Fortran RejectNegative Joined UInteger Var(flag_max_subrecord_length) -fmax-subrecord-length= Maximum length for subrecords fmax-stack-var-size= -Fortran RejectNegative Joined UInteger +Fortran RejectNegative Joined UInteger Var(flag_max_stack_var_size) Init(-2) -fmax-stack-var-size= Size in bytes of the largest array that will be put on the stack fstack-arrays -Fortran +Fortran Var(flag_stack_arrays) Init(-1) Put all local arrays on stack. fmodule-private @@ -562,7 +562,7 @@ Fortran ; Documented in C fprotect-parens -Fortran +Fortran Var(flag_protect_parens) Init(-1) Protect parentheses in expressions frange-check @@ -570,39 +570,39 @@ Fortran Enable range checking during compilation freal-4-real-8 -Fortran RejectNegative +Fortran RejectNegative Var(flag_real4_kind,8) Interpret any REAL(4) as a REAL(8) freal-4-real-10 -Fortran RejectNegative +Fortran RejectNegative Var(flag_real4_kind,10) Interpret any REAL(4) as a REAL(10) freal-4-real-16 -Fortran RejectNegative +Fortran RejectNegative Var(flag_real4_kind,16) Interpret any REAL(4) as a REAL(16) freal-8-real-4 -Fortran RejectNegative +Fortran RejectNegative Var(flag_real8_kind,4) Interpret any REAL(8) as a REAL(4) freal-8-real-10 -Fortran RejectNegative +Fortran RejectNegative Var(flag_real8_kind,10) Interpret any REAL(8) as a REAL(10) freal-8-real-16 -Fortran RejectNegative +Fortran RejectNegative Var(flag_real8_kind,16) Interpret any REAL(8) as a REAL(16) frealloc-lhs -Fortran +Fortran Var(flag_realloc_lhs) Init(-1) Reallocate the LHS in assignments frecord-marker=4 -Fortran RejectNegative +Fortran RejectNegative Var(flag_record_marker,4) Use a 4-byte record marker for unformatted files frecord-marker=8 -Fortran RejectNegative +Fortran RejectNegative Var(flag_record_marker,8) Use an 8-byte record marker for unformatted files frecursive @@ -622,7 +622,7 @@ Fortran RejectNegative JoinedOrMissing -fcheck=[...] Specify which runtime checks are to be performed fsecond-underscore -Fortran +Fortran Var(flag_second_underscore) Init(-1) Append a second underscore if the name already contains an underscore fshort-enums diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 84c1163486e..a3ec1a1e3cf 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -6597,13 +6597,13 @@ use_iso_fortran_env_module (void) "standard", symbol[i].name, &u->where)) continue; - if ((gfc_option.flag_default_integer || gfc_option.flag_default_real) + if ((flag_default_integer || flag_default_real) && symbol[i].id == ISOFORTRANENV_NUMERIC_STORAGE_SIZE) gfc_warning_now ("Use of the NUMERIC_STORAGE_SIZE named " "constant from intrinsic module " "ISO_FORTRAN_ENV at %L is incompatible with " "option %qs", &u->where, - gfc_option.flag_default_integer + flag_default_integer ? "-fdefault-integer-8" : "-fdefault-real-8"); switch (symbol[i].id) @@ -6664,12 +6664,12 @@ use_iso_fortran_env_module (void) if ((gfc_option.allow_std & symbol[i].standard) == 0) continue; - if ((gfc_option.flag_default_integer || gfc_option.flag_default_real) + if ((flag_default_integer || flag_default_real) && symbol[i].id == ISOFORTRANENV_NUMERIC_STORAGE_SIZE) gfc_warning_now ("Use of the NUMERIC_STORAGE_SIZE named constant " "from intrinsic module ISO_FORTRAN_ENV at %C is " "incompatible with option %s", - gfc_option.flag_default_integer + flag_default_integer ? "-fdefault-integer-8" : "-fdefault-real-8"); switch (symbol[i].id) diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index af71ded54d0..5a1be120da0 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -81,37 +81,22 @@ gfc_init_options (unsigned int decoded_options_count, gfc_source_file = NULL; gfc_option.module_dir = NULL; gfc_option.source_form = FORM_UNKNOWN; - gfc_option.fixed_line_length = 72; - gfc_option.free_line_length = 132; gfc_option.max_continue_fixed = 255; gfc_option.max_continue_free = 255; gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN; - gfc_option.max_subrecord_length = 0; gfc_option.flag_max_array_constructor = 65535; gfc_option.convert = GFC_CONVERT_NATIVE; - gfc_option.record_marker = 0; gfc_option.dump_fortran_original = 0; gfc_option.dump_fortran_optimized = 0; gfc_option.max_errors = 25; gfc_option.flag_all_intrinsics = 0; - gfc_option.flag_default_double = 0; - gfc_option.flag_default_integer = 0; - gfc_option.flag_default_real = 0; - gfc_option.flag_integer4_kind = 0; - gfc_option.flag_real4_kind = 0; - gfc_option.flag_real8_kind = 0; gfc_option.flag_dollar_ok = 0; gfc_option.flag_underscoring = 1; gfc_option.flag_f2c = 0; - gfc_option.flag_second_underscore = -1; gfc_option.flag_implicit_none = 0; - /* 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 = -1; - gfc_option.flag_range_check = 1; gfc_option.flag_pack_derived = 0; gfc_option.flag_repack_arrays = 0; @@ -135,10 +120,7 @@ gfc_init_options (unsigned int decoded_options_count, gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF; gfc_option.flag_init_character_value = (char)0; gfc_option.flag_align_commons = 1; - gfc_option.flag_protect_parens = -1; - gfc_option.flag_realloc_lhs = -1; gfc_option.flag_aggressive_function_elimination = 0; - gfc_option.flag_frontend_optimize = -1; gfc_option.fpe = 0; /* All except GFC_FPE_INEXACT. */ @@ -259,20 +241,20 @@ gfc_post_options (const char **pfilename) if (flag_associative_math == -1) flag_associative_math = (!flag_trapping_math && !flag_signed_zeros); - if (gfc_option.flag_protect_parens == -1) - gfc_option.flag_protect_parens = !optimize_fast; + if (flag_protect_parens == -1) + flag_protect_parens = !optimize_fast; - if (gfc_option.flag_stack_arrays == -1) - gfc_option.flag_stack_arrays = optimize_fast; + if (flag_stack_arrays == -1) + 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) + if (flag_realloc_lhs == -1) { if (gfc_option.allow_std & GFC_STD_F2003) - gfc_option.flag_realloc_lhs = 1; + flag_realloc_lhs = 1; else - gfc_option.flag_realloc_lhs = 0; + flag_realloc_lhs = 0; } /* -fbounds-check is equivalent to -fcheck=bounds */ @@ -364,53 +346,60 @@ gfc_post_options (const char **pfilename) /* If the user didn't explicitly specify -f(no)-second-underscore we use it if we're trying to be compatible with f2c, and not otherwise. */ - if (gfc_option.flag_second_underscore == -1) - gfc_option.flag_second_underscore = gfc_option.flag_f2c; + if (flag_second_underscore == -1) + 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) + if (!gfc_option.flag_automatic && flag_max_stack_var_size != -2 + && 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); + 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.gfc_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) + "%<-fopenmp%>"); + else if (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.gfc_flag_openmp) + flag_max_stack_var_size); + else if (flag_max_stack_var_size != -2 && gfc_option.gfc_flag_openmp) gfc_warning_now ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> " - "implied by %<-fopenmp%>", - gfc_option.flag_max_stack_var_size); + "implied by %<-fopenmp%>", flag_max_stack_var_size); /* Implement -frecursive as -fmax-stack-var-size=-1. */ if (gfc_option.flag_recursive) - gfc_option.flag_max_stack_var_size = -1; + flag_max_stack_var_size = -1; /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */ - if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.gfc_flag_openmp + if (flag_max_stack_var_size == -2 && gfc_option.gfc_flag_openmp && gfc_option.flag_automatic) { gfc_option.flag_recursive = 1; - gfc_option.flag_max_stack_var_size = -1; + 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; + if (flag_max_stack_var_size == -2) + flag_max_stack_var_size = 32768; /* Implement -fno-automatic as -fmax-stack-var-size=0. */ if (!gfc_option.flag_automatic) - gfc_option.flag_max_stack_var_size = 0; + flag_max_stack_var_size = 0; /* Optimization implies front end optimization, unless the user specified it directly. */ - if (gfc_option.flag_frontend_optimize == -1) - gfc_option.flag_frontend_optimize = optimize; + if (flag_frontend_optimize == -1) + flag_frontend_optimize = optimize; + + if (flag_fixed_line_length != 0 && flag_fixed_line_length < 7) + gfc_fatal_error ("Fixed line length must be at least seven"); + + if (flag_free_line_length != 0 && flag_free_line_length < 4) + gfc_fatal_error ("Free line length must be at least three"); + + if (flag_max_subrecord_length > MAX_SUBRECORD_LENGTH) + gfc_fatal_error ("Maximum subrecord length cannot exceed %d", + MAX_SUBRECORD_LENGTH); gfc_cpp_post_options (); @@ -643,16 +632,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.source_form = FORM_FIXED; break; - case OPT_ffixed_line_length_none: - gfc_option.fixed_line_length = 0; - break; - - case OPT_ffixed_line_length_: - if (value != 0 && value < 7) - gfc_fatal_error ("Fixed line length must be at least seven"); - gfc_option.fixed_line_length = value; - break; - case OPT_ffree_form: gfc_option.source_form = FORM_FREE; break; @@ -665,24 +644,10 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.gfc_flag_openmp_simd = value; break; - case OPT_ffree_line_length_none: - gfc_option.free_line_length = 0; - break; - - case OPT_ffree_line_length_: - if (value != 0 && value < 4) - gfc_fatal_error ("Free line length must be at least three"); - gfc_option.free_line_length = value; - break; - case OPT_funderscoring: gfc_option.flag_underscoring = value; break; - case OPT_fsecond_underscore: - gfc_option.flag_second_underscore = value; - break; - case OPT_static_libgfortran: #ifndef HAVE_LD_STATIC_DYNAMIC gfc_fatal_error ("%<-static-libgfortran%> is not supported in this " @@ -710,14 +675,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.flag_max_array_constructor = value > 65535 ? value : 65535; break; - case OPT_fmax_stack_var_size_: - gfc_option.flag_max_stack_var_size = value; - break; - - case OPT_fstack_arrays: - gfc_option.flag_stack_arrays = value; - break; - case OPT_fmodule_private: gfc_option.flag_module_private = value; break; @@ -745,46 +702,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.max_identifier_length = value; break; - case OPT_fdefault_integer_8: - gfc_option.flag_default_integer = value; - break; - - case OPT_fdefault_real_8: - gfc_option.flag_default_real = value; - break; - - case OPT_fdefault_double_8: - gfc_option.flag_default_double = value; - break; - - case OPT_finteger_4_integer_8: - gfc_option.flag_integer4_kind = 8; - break; - - case OPT_freal_4_real_8: - gfc_option.flag_real4_kind = 8; - break; - - case OPT_freal_4_real_10: - gfc_option.flag_real4_kind = 10; - break; - - case OPT_freal_4_real_16: - gfc_option.flag_real4_kind = 16; - break; - - case OPT_freal_8_real_4: - gfc_option.flag_real8_kind = 4; - break; - - case OPT_freal_8_real_10: - gfc_option.flag_real8_kind = 10; - break; - - case OPT_freal_8_real_16: - gfc_option.flag_real8_kind = 16; - break; - case OPT_finit_local_zero: gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON; gfc_option.flag_init_integer_value = 0; @@ -924,22 +841,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.convert = GFC_CONVERT_SWAP; break; - case OPT_frecord_marker_4: - gfc_option.record_marker = 4; - break; - - case OPT_frecord_marker_8: - gfc_option.record_marker = 8; - break; - - case OPT_fmax_subrecord_length_: - if (value > MAX_SUBRECORD_LENGTH) - gfc_fatal_error ("Maximum subrecord length cannot exceed %d", - MAX_SUBRECORD_LENGTH); - - gfc_option.max_subrecord_length = value; - break; - case OPT_frecursive: gfc_option.flag_recursive = value; break; @@ -952,18 +853,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, gfc_option.flag_aggressive_function_elimination = value; break; - case OPT_ffrontend_optimize: - gfc_option.flag_frontend_optimize = value; - break; - - case OPT_fprotect_parens: - gfc_option.flag_protect_parens = value; - break; - - case OPT_frealloc_lhs: - gfc_option.flag_realloc_lhs = value; - break; - case OPT_fcheck_: gfc_handle_runtime_check_option (arg); break; diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 18791ceaf03..337f5f67b88 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -224,7 +224,7 @@ match_integer_constant (gfc_expr **result, int signflag) if (kind == -1) return MATCH_ERROR; - if (kind == 4 && gfc_option.flag_integer4_kind == 8) + if (kind == 4 && flag_integer4_kind == 8) kind = 8; if (gfc_validate_kind (BT_INTEGER, kind, true) < 0) @@ -639,21 +639,21 @@ done: if (kind == 4) { - if (gfc_option.flag_real4_kind == 8) + if (flag_real4_kind == 8) kind = 8; - if (gfc_option.flag_real4_kind == 10) + if (flag_real4_kind == 10) kind = 10; - if (gfc_option.flag_real4_kind == 16) + if (flag_real4_kind == 16) kind = 16; } if (kind == 8) { - if (gfc_option.flag_real8_kind == 4) + if (flag_real8_kind == 4) kind = 4; - if (gfc_option.flag_real8_kind == 10) + if (flag_real8_kind == 10) kind = 10; - if (gfc_option.flag_real8_kind == 16) + if (flag_real8_kind == 16) kind = 16; } break; @@ -688,21 +688,21 @@ done: if (kind == 4) { - if (gfc_option.flag_real4_kind == 8) + if (flag_real4_kind == 8) kind = 8; - if (gfc_option.flag_real4_kind == 10) + if (flag_real4_kind == 10) kind = 10; - if (gfc_option.flag_real4_kind == 16) + if (flag_real4_kind == 16) kind = 16; } if (kind == 8) { - if (gfc_option.flag_real8_kind == 4) + if (flag_real8_kind == 4) kind = 4; - if (gfc_option.flag_real8_kind == 10) + if (flag_real8_kind == 10) kind = 10; - if (gfc_option.flag_real8_kind == 16) + if (flag_real8_kind == 16) kind = 16; } diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index c74f8fb6da7..ee48a6a06cc 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -9356,7 +9356,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns) if (!gfc_notify_std (GFC_STD_F2008, "Assignment to an allocatable " "polymorphic variable at %L", &lhs->where)) return false; - if (!gfc_option.flag_realloc_lhs) + if (!flag_realloc_lhs) { gfc_error ("Assignment to an allocatable polymorphic variable at %L " "requires %<-frealloc-lhs%>", &lhs->where); @@ -10781,7 +10781,7 @@ build_default_init_expr (gfc_symbol *sym) init_expr = NULL; } if (!init_expr && gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON - && sym->ts.u.cl->length && gfc_option.flag_max_stack_var_size != 0) + && sym->ts.u.cl->length && flag_max_stack_var_size != 0) { gfc_actual_arglist *arg; init_expr = gfc_get_expr (); @@ -10831,7 +10831,7 @@ apply_default_init_local (gfc_symbol *sym) are stack allocated even with -fno-automatic; we have also to exclude result variable, which are also nonstatic. */ if (sym->attr.save || sym->ns->save_all - || (gfc_option.flag_max_stack_var_size == 0 && !sym->attr.result + || (flag_max_stack_var_size == 0 && !sym->attr.result && !sym->ns->proc_name->attr.recursive && (!sym->attr.dimension || !is_non_constant_shape_array (sym)))) { diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 6a37036fb7d..7a9f62695aa 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1051,7 +1051,7 @@ restart: if (warn_line_truncation && gfc_current_locus.lb != NULL && gfc_current_locus.lb->truncated) { - int maxlen = gfc_option.free_line_length; + int maxlen = flag_free_line_length; gfc_char_t *current_nextc = gfc_current_locus.nextc; gfc_current_locus.lb->truncated = 0; @@ -1434,9 +1434,9 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char) /* Determine the maximum allowed line length. */ if (gfc_current_form == FORM_FREE) - maxlen = gfc_option.free_line_length; + maxlen = flag_free_line_length; else if (gfc_current_form == FORM_FIXED) - maxlen = gfc_option.fixed_line_length; + maxlen = flag_fixed_line_length; else maxlen = 72; @@ -1610,7 +1610,7 @@ next_char: /* Pad lines to the selected line length in fixed form. */ if (gfc_current_form == FORM_FIXED - && gfc_option.fixed_line_length != 0 + && flag_fixed_line_length != 0 && !preprocessor_flag && c != EOF) { diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index f02ff32247a..d637b5b6a3c 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -830,7 +830,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, { /* Allocate the temporary. */ onstack = !dynamic && initial == NULL_TREE - && (gfc_option.flag_stack_arrays + && (flag_stack_arrays || gfc_can_put_var_on_stack (size)); if (onstack) @@ -3950,7 +3950,7 @@ done: continue; /* Catch allocatable lhs in f2003. */ - if (gfc_option.flag_realloc_lhs && ss->is_alloc_lhs) + if (flag_realloc_lhs && ss->is_alloc_lhs) continue; expr = ss_info->expr; @@ -4349,7 +4349,7 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, if (ss->info->type != GFC_SS_SECTION) { - if (gfc_option.flag_realloc_lhs + if (flag_realloc_lhs && dest_expr != ss_expr && gfc_is_reallocatable_lhs (dest_expr) && ss_expr->rank) @@ -5701,7 +5701,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, return; } - if (gfc_option.flag_stack_arrays) + if (flag_stack_arrays) { gcc_assert (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE); space = build_decl (sym->declared_at.lb->location, diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index 1c54ef47c6b..3043c61dd88 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -257,7 +257,7 @@ gfc_sym_mangled_common_id (gfc_common_head *com) if (gfc_option.flag_underscoring) { has_underscore = strchr (name, '_') != 0; - if (gfc_option.flag_second_underscore && has_underscore) + if (flag_second_underscore && has_underscore) snprintf (mangled_name, sizeof mangled_name, "%s__", name); else snprintf (mangled_name, sizeof mangled_name, "%s_", name); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 780d350e31d..e3895acc195 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -396,7 +396,7 @@ gfc_sym_mangled_function_id (gfc_symbol * sym) if (gfc_option.flag_underscoring) { has_underscore = strchr (sym->name, '_') != 0; - if (gfc_option.flag_second_underscore && has_underscore) + if (flag_second_underscore && has_underscore) snprintf (name, sizeof name, "%s__", sym->name); else snprintf (name, sizeof name, "%s_", sym->name); @@ -431,14 +431,14 @@ gfc_can_put_var_on_stack (tree size) if (!INTEGER_CST_P (size)) return 0; - if (gfc_option.flag_max_stack_var_size < 0) + if (flag_max_stack_var_size < 0) return 1; if (!tree_fits_uhwi_p (size)) return 0; low = TREE_INT_CST_LOW (size); - if (low > (unsigned HOST_WIDE_INT) gfc_option.flag_max_stack_var_size) + if (low > (unsigned HOST_WIDE_INT) flag_max_stack_var_size) return 0; /* TODO: Set a per-function stack size limit. */ @@ -1148,7 +1148,7 @@ gfc_create_string_length (gfc_symbol * sym) it is an automatic variable. */ bool static_length = sym->attr.save || sym->ns->proc_name->attr.flavor == FL_MODULE - || (gfc_option.flag_max_stack_var_size == 0 + || (flag_max_stack_var_size == 0 && sym->ts.deferred && !sym->attr.dummy && !sym->attr.result && !sym->attr.function); @@ -1546,7 +1546,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) if (TREE_STATIC (decl) && !(sym->attr.use_assoc && !intrinsic_array_parameter) && (sym->attr.save || sym->ns->proc_name->attr.is_main_program - || gfc_option.flag_max_stack_var_size == 0 + || flag_max_stack_var_size == 0 || sym->attr.data || sym->ns->proc_name->attr.flavor == FL_MODULE) && (gfc_option.coarray != GFC_FCOARRAY_LIB || !sym->attr.codimension || sym->attr.allocatable)) @@ -3878,7 +3878,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) } if (sym->ts.type == BT_CLASS - && (sym->attr.save || gfc_option.flag_max_stack_var_size == 0) + && (sym->attr.save || flag_max_stack_var_size == 0) && CLASS_DATA (sym)->attr.allocatable) { tree vptr; @@ -4007,7 +4007,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) || (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->attr.allocatable))) { - if (!sym->attr.save && gfc_option.flag_max_stack_var_size != 0) + if (!sym->attr.save && flag_max_stack_var_size != 0) { tree descriptor = NULL_TREE; @@ -5495,21 +5495,21 @@ create_main_function (tree fndecl) /* If this is the main program and an -frecord-marker option was provided, add a call to set_record_marker. */ - if (gfc_option.record_marker != 0) + if (flag_record_marker != 0) { tmp = build_call_expr_loc (input_location, gfor_fndecl_set_record_marker, 1, build_int_cst (integer_type_node, - gfc_option.record_marker)); + flag_record_marker)); gfc_add_expr_to_block (&body, tmp); } - if (gfc_option.max_subrecord_length != 0) + if (flag_max_subrecord_length != 0) { tmp = build_call_expr_loc (input_location, gfor_fndecl_set_max_subrecord_length, 1, build_int_cst (integer_type_node, - gfc_option.max_subrecord_length)); + flag_max_subrecord_length)); gfc_add_expr_to_block (&body, tmp); } diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index a82203cca45..143decc9489 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2653,9 +2653,8 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr) switch (expr->value.op.op) { case INTRINSIC_PARENTHESES: - if ((expr->ts.type == BT_REAL - || expr->ts.type == BT_COMPLEX) - && gfc_option.flag_protect_parens) + if ((expr->ts.type == BT_REAL || expr->ts.type == BT_COMPLEX) + && flag_protect_parens) { gfc_conv_unary_op (PAREN_EXPR, se, expr); gcc_assert (FLOAT_TYPE_P (TREE_TYPE (se->expr))); @@ -5176,7 +5175,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, /* If the lhs of an assignment x = f(..) is allocatable and f2003 is allowed, we must do the automatic reallocation. TODO - deal with intrinsics, without using a temporary. */ - if (gfc_option.flag_realloc_lhs + if (flag_realloc_lhs && se->ss && se->ss->loop_chain && se->ss->loop_chain->is_alloc_lhs && !expr->value.function.isym @@ -5214,8 +5213,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, f2003 is allowed, we must not generate the function call here but should just send back the results of the mapping. This is signalled by the function ss being flagged. */ - if (gfc_option.flag_realloc_lhs - && se->ss && se->ss->is_alloc_lhs) + if (flag_realloc_lhs && se->ss && se->ss->is_alloc_lhs) { gfc_free_interface_mapping (&mapping); return has_alternate_specifier; @@ -5250,8 +5248,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, f2003 is allowed, we must not generate the function call here but should just send back the results of the mapping. This is signalled by the function ss being flagged. */ - if (gfc_option.flag_realloc_lhs - && se->ss && se->ss->is_alloc_lhs) + if (flag_realloc_lhs && se->ss && se->ss->is_alloc_lhs) { gfc_free_interface_mapping (&mapping); return has_alternate_specifier; @@ -7409,9 +7406,7 @@ arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2) need a temporary except in the particular case that reallocation on assignment is active and the lhs is allocatable and a target. */ if (expr2->value.function.isym) - return (gfc_option.flag_realloc_lhs - && sym->attr.allocatable - && sym->attr.target); + return (flag_realloc_lhs && sym->attr.allocatable && sym->attr.target); /* If the LHS is a dummy, we need a temporary if it is not INTENT(OUT). */ @@ -7652,7 +7647,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) calls, the array data is freed and the library takes care of allocation. TODO: Add logic of trans-array.c: gfc_alloc_allocatable_for_assignment to the library. */ - if (gfc_option.flag_realloc_lhs + if (flag_realloc_lhs && gfc_is_reallocatable_lhs (expr1) && !gfc_expr_attr (expr1).codimension && !gfc_is_coindexed (expr1) @@ -8312,8 +8307,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, otherwise the character length of the result is not known. NOTE: This relies on having the exact dependence of the length type parameter available to the caller; gfortran saves it in the .mod files. */ - if (gfc_option.flag_realloc_lhs && expr2->ts.type == BT_CHARACTER - && expr1->ts.deferred) + if (flag_realloc_lhs && expr2->ts.type == BT_CHARACTER && expr1->ts.deferred) gfc_add_block_to_block (&block, &rse.pre); tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts, @@ -8325,8 +8319,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, if (lss == gfc_ss_terminator) { /* F2003: Add the code for reallocation on assignment. */ - if (gfc_option.flag_realloc_lhs - && is_scalar_reallocatable_lhs (expr1)) + if (flag_realloc_lhs && is_scalar_reallocatable_lhs (expr1)) alloc_scalar_allocatable_for_assignment (&block, rse.string_length, expr1, expr2); @@ -8366,7 +8359,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, } /* F2003: Allocate or reallocate lhs of allocatable array. */ - if (gfc_option.flag_realloc_lhs + if (flag_realloc_lhs && gfc_is_reallocatable_lhs (expr1) && !gfc_expr_attr (expr1).codimension && !gfc_is_coindexed (expr1) diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 1ba382ab193..8eda2d88ee2 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -5328,11 +5328,11 @@ gfc_trans_allocate (gfc_code * code) { /* Switch off automatic reallocation since we have just done the ALLOCATE. */ - int realloc_lhs = gfc_option.flag_realloc_lhs; - gfc_option.flag_realloc_lhs = 0; + int realloc_lhs = flag_realloc_lhs; + flag_realloc_lhs = 0; tmp = gfc_trans_assignment (gfc_expr_to_initialize (expr), rhs, false, false); - gfc_option.flag_realloc_lhs = realloc_lhs; + flag_realloc_lhs = realloc_lhs; } gfc_free_expr (rhs); gfc_add_expr_to_block (&block, tmp); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 12536e9a9ef..304b027da4b 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -493,7 +493,7 @@ gfc_init_kinds (void) gfc_numeric_storage_size = 4 * 8; - if (gfc_option.flag_default_integer) + if (flag_default_integer) { if (!saw_i8) gfc_fatal_error ("INTEGER(KIND=8) is not available for " @@ -502,7 +502,7 @@ gfc_init_kinds (void) gfc_default_integer_kind = 8; } - else if (gfc_option.flag_integer4_kind == 8) + else if (flag_integer4_kind == 8) { if (!saw_i8) gfc_fatal_error ("INTEGER(KIND=8) is not available for " @@ -521,7 +521,7 @@ gfc_init_kinds (void) } /* Choose the default real kind. Again, we choose 4 when possible. */ - if (gfc_option.flag_default_real) + if (flag_default_real) { if (!saw_r8) gfc_fatal_error ("REAL(KIND=8) is not available for " @@ -529,7 +529,7 @@ gfc_init_kinds (void) gfc_default_real_kind = 8; } - else if (gfc_option.flag_real4_kind == 8) + else if (flag_real4_kind == 8) { if (!saw_r8) gfc_fatal_error ("REAL(KIND=8) is not available for %<-freal-4-real-8%> " @@ -537,7 +537,7 @@ gfc_init_kinds (void) gfc_default_real_kind = 8; } - else if (gfc_option.flag_real4_kind == 10) + else if (flag_real4_kind == 10) { if (!saw_r10) gfc_fatal_error ("REAL(KIND=10) is not available for " @@ -545,7 +545,7 @@ gfc_init_kinds (void) gfc_default_real_kind = 10; } - else if (gfc_option.flag_real4_kind == 16) + else if (flag_real4_kind == 16) { if (!saw_r16) gfc_fatal_error ("REAL(KIND=16) is not available for " @@ -562,15 +562,15 @@ gfc_init_kinds (void) are specified, we use kind=8, if it's available. If -fdefault-real is specified without -fdefault-double, we use kind=16, if it's available. Otherwise we do not change anything. */ - if (gfc_option.flag_default_double && !gfc_option.flag_default_real) + if (flag_default_double && !flag_default_real) gfc_fatal_error ("Use of %<-fdefault-double-8%> requires " "%<-fdefault-real-8%>"); - if (gfc_option.flag_default_real && gfc_option.flag_default_double && saw_r8) + if (flag_default_real && flag_default_double && saw_r8) gfc_default_double_kind = 8; - else if (gfc_option.flag_default_real && saw_r16) + else if (flag_default_real && saw_r16) gfc_default_double_kind = 16; - else if (gfc_option.flag_real8_kind == 4) + else if (flag_real8_kind == 4) { if (!saw_r4) gfc_fatal_error ("REAL(KIND=4) is not available for " @@ -578,7 +578,7 @@ gfc_init_kinds (void) gfc_default_double_kind = 4; } - else if (gfc_option.flag_real8_kind == 10 ) + else if (flag_real8_kind == 10 ) { if (!saw_r10) gfc_fatal_error ("REAL(KIND=10) is not available for " @@ -586,7 +586,7 @@ gfc_init_kinds (void) gfc_default_double_kind = 10; } - else if (gfc_option.flag_real8_kind == 16 ) + else if (flag_real8_kind == 16 ) { if (!saw_r16) gfc_fatal_error ("REAL(KIND=10) is not available for "