+2014-12-16 Tobias Burnus <burnus@net-b.de>
+
+ * 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 <janus@gcc.gnu.org>
PR fortran/64244
}
- 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;
}
}
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;
}
}
doloop_warn (ns);
doloop_list.release ();
- if (gfc_option.flag_frontend_optimize)
+ if (flag_frontend_optimize)
{
optimize_namespace (ns);
optimize_reduction (ns);
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
{
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;
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;
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;
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;
int warn_std;
int allow_std;
int convert;
- int record_marker;
- int max_subrecord_length;
}
gfc_option_t;
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
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
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-<n> Use n as character line width in fixed mode
ffpe-trap=
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-<n> 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
-fmax-identifier-length=<n> Maximum identifier length
fmax-subrecord-length=
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_max_subrecord_length)
-fmax-subrecord-length=<n> 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=<n> 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
; Documented in C
fprotect-parens
-Fortran
+Fortran Var(flag_protect_parens) Init(-1)
Protect parentheses in expressions
frange-check
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
-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
"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)
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)
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;
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. */
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 */
/* 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 ();
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;
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 "
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;
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;
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;
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;
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)
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;
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;
}
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);
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 ();
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))))
{
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;
/* 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;
/* 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)
{
{
/* 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)
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;
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)
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,
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);
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);
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. */
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);
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))
}
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;
|| (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;
/* 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);
}
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)));
/* 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
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;
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;
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). */
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)
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,
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);
}
/* 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)
{
/* 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);
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 "
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 "
}
/* 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 "
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%> "
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 "
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 "
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 "
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 "
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 "