+2014-12-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54687
+ * flag-types.h (gfc_init_local_real, gfc_fcoarray,
+ gfc_convert): New enums; moved from fortran/.
+
2014-12-16 Jan Hubicka <hubicka@ucw.cz>
* fibonacci_heap.h (min): Return m_data instead of non-existing data.
LTO_PARTITION_MAX = 4
};
+
+/* gfortran -finit-real= values. */
+
+enum gfc_init_local_real
+{
+ GFC_INIT_REAL_OFF = 0,
+ GFC_INIT_REAL_ZERO,
+ GFC_INIT_REAL_NAN,
+ GFC_INIT_REAL_SNAN,
+ GFC_INIT_REAL_INF,
+ GFC_INIT_REAL_NEG_INF
+};
+
+/* gfortran -fcoarray= values. */
+
+enum gfc_fcoarray
+{
+ GFC_FCOARRAY_NONE = 0,
+ GFC_FCOARRAY_SINGLE,
+ GFC_FCOARRAY_LIB
+};
+
+
+/* gfortran -fconvert= values; used for unformatted I/O.
+ Keep in sync with GFC_CONVERT_* in gcc/fortran/libgfortran.h. */
+enum gfc_convert
+{
+ GFC_FLAG_CONVERT_NATIVE = 0,
+ GFC_FLAG_CONVERT_SWAP,
+ GFC_FLAG_CONVERT_BIG,
+ GFC_FLAG_CONVERT_LITTLE
+};
+
+
#endif /* ! GCC_FLAG_TYPES_H */
+2014-12-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54687
+ * gfortran.h (gfc_option_t): Remove flags which now
+ have a Var().
+ (init_local_real, gfc_fcoarray): Moved to ../flag-types.h.
+ * libgfortran.h (unit_convert): Add comment.
+ * lang.opt (flag-convert, flag-init_real, flag-coarray):
+ Add Var() and Enum().
+ * options.c (gfc_handle_coarray_option): Remove.
+ (gfc_init_options, gfc_post_options, gfc_handle_option):
+ Update for *.opt changes.
+ * array.c: Update for flag-variable name changes.
+ * check.c: Ditto.
+ * match.c: Ditto.
+ * resolve.c: Ditto.
+ * simplify.c: Ditto.
+ * trans-array.c: Ditto.
+ * trans-decl.c: Ditto.
+ * trans-expr.c: Ditto.
+ * trans-intrinsic.c: Ditto.
+ * trans-stmt.c: Ditto.
+ * trans-types.c: Ditto.
+ * trans.c: Ditto.
+
2014-12-16 Tobias Burnus <burnus@net-b.de>
PR fortran/54687
return MATCH_ERROR;
}
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return MATCH_ERROR;
if (!gfc_notify_std (GFC_STD_F2008, "Coarray declaration at %C"))
goto cleanup;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
goto cleanup;
}
}
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
&a->where);
bool
gfc_check_lcobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
{
mpz_t nelems;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
bool
gfc_check_num_images (gfc_expr *distance, gfc_expr *failed)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
bool
gfc_check_this_image (gfc_expr *coarray, gfc_expr *dim, gfc_expr *distance)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
bool
gfc_check_ucobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
};
typedef enum gfc_isym_id gfc_isym_id;
-
-typedef enum
-{
- GFC_INIT_REAL_OFF = 0,
- GFC_INIT_REAL_ZERO,
- GFC_INIT_REAL_NAN,
- GFC_INIT_REAL_SNAN,
- GFC_INIT_REAL_INF,
- GFC_INIT_REAL_NEG_INF
-}
-init_local_real;
-
typedef enum
{
GFC_INIT_LOGICAL_OFF = 0,
}
init_local_integer;
-typedef enum
-{
- GFC_FCOARRAY_NONE = 0,
- GFC_FCOARRAY_SINGLE,
- GFC_FCOARRAY_LIB
-}
-gfc_fcoarray;
-
typedef enum
{
GFC_ENABLE_REVERSE,
int flag_d_lines;
int flag_init_integer;
int flag_init_integer_value;
- int flag_init_real;
int flag_init_logical;
int flag_init_character;
char flag_init_character_value;
int fpe;
int fpe_summary;
int rtcheck;
- gfc_fcoarray coarray;
int warn_std;
int allow_std;
- int convert;
}
gfc_option_t;
Fortran
Produce a warning at runtime if a array temporary has been created for a procedure argument
-fconvert=big-endian
-Fortran RejectNegative
-Use big-endian format for unformatted files
+fconvert=
+Fortran RejectNegative Joined Enum(gfc_convert) Var(flag_convert) Init(GFC_FLAG_CONVERT_NATIVE)
+-fconvert=<big-endian|little-endian|native|swap> The endianness used for unformatted files.
-fconvert=little-endian
-Fortran RejectNegative
-Use little-endian format for unformatted files
+Enum
+Name(gfc_convert) Type(enum gfc_convert) UnknownError(Unrecognized option to endianess value: %qs)
-fconvert=native
-Fortran RejectNegative
-Use native format for unformatted files
+EnumValue
+Enum(gfc_convert) String(big-endian) Value(GFC_FLAG_CONVERT_BIG)
-fconvert=swap
-Fortran RejectNegative
-Swap endianness for unformatted files
+EnumValue
+Enum(gfc_convert) String(little-endian) Value(GFC_FLAG_CONVERT_LITTLE)
+
+EnumValue
+Enum(gfc_convert) String(native) Value(GFC_FLAG_CONVERT_NATIVE)
+
+EnumValue
+Enum(gfc_convert) String(swap) Value(GFC_FLAG_CONVERT_SWAP)
fcray-pointer
Fortran Var(flag_cray_pointer)
-finit-logical=<true|false> Initialize local logical variables
finit-real=
-Fortran RejectNegative Joined
--finit-real=<zero|nan|inf|-inf> Initialize local real variables
+Fortran RejectNegative ToLower Joined Enum(gfc_init_local_real) Var(flag_init_real) Init(GFC_INIT_REAL_OFF)
+-finit-real=<zero|snan|nan|inf|-inf> Initialize local real variables
+
+Enum
+Name(gfc_init_local_real) Type(enum gfc_init_local_real) UnknownError(Unrecognized option to floating-point init value: %qs)
+
+EnumValue
+Enum(gfc_init_local_real) String(zero) Value(GFC_INIT_REAL_ZERO)
+
+EnumValue
+Enum(gfc_init_local_real) String(snan) Value(GFC_INIT_REAL_SNAN)
+
+EnumValue
+Enum(gfc_init_local_real) String(nan) Value(GFC_INIT_REAL_NAN)
+
+EnumValue
+Enum(gfc_init_local_real) String(inf) Value(GFC_INIT_REAL_INF)
+
+EnumValue
+Enum(gfc_init_local_real) String(-inf) Value(GFC_INIT_REAL_NEG_INF)
fmax-array-constructor=
Fortran RejectNegative Joined UInteger Var(flag_max_array_constructor) Init(65535)
Copy array sections into a contiguous block on procedure entry
fcoarray=
-Fortran RejectNegative JoinedOrMissing
--fcoarray=[...] Specify which coarray parallelization should be used
+Fortran RejectNegative Joined Enum(gfc_fcoarray) Var(flag_coarray) Init(GFC_FCOARRAY_NONE)
+-fcoarray=<none|single|lib> Specify which coarray parallelization should be used
+
+Enum
+Name(gfc_fcoarray) Type(enum gfc_fcoarray) UnknownError(Unrecognized option: %qs)
+
+EnumValue
+Enum(gfc_fcoarray) String(none) Value(GFC_FCOARRAY_NONE)
+
+EnumValue
+Enum(gfc_fcoarray) String(single) Value(GFC_FCOARRAY_SINGLE)
+
+EnumValue
+Enum(gfc_fcoarray) String(lib) Value(GFC_FCOARRAY_LIB)
fcheck=
Fortran RejectNegative JoinedOrMissing
/* Possible values for the CONVERT I/O specifier. */
+/* Keep in sync with GFC_FLAG_CONVERT_* in gcc/flags.h. */
typedef enum
{
GFC_CONVERT_NONE = -1,
if (!gfc_notify_std (GFC_STD_F2008, "CRITICAL statement at %C"))
return MATCH_ERROR;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to "
"enable");
gfc_unset_implicit_pure (NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return MATCH_ERROR;
if (!gfc_notify_std (GFC_STD_F2008, "SYNC statement at %C"))
return MATCH_ERROR;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to "
"enable");
gfc_option.max_continue_fixed = 255;
gfc_option.max_continue_free = 255;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
- gfc_option.convert = GFC_CONVERT_NATIVE;
gfc_option.max_errors = 25;
gfc_option.flag_preprocessed = 0;
gfc_option.flag_d_lines = -1;
gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF;
gfc_option.flag_init_integer_value = 0;
- gfc_option.flag_init_real = GFC_INIT_REAL_OFF;
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
gfc_option.flag_init_character_value = (char)0;
| GFC_FPE_ZERO | GFC_FPE_OVERFLOW
| GFC_FPE_UNDERFLOW;
gfc_option.rtcheck = 0;
- gfc_option.coarray = GFC_FCOARRAY_NONE;
/* ??? Wmissing-include-dirs is disabled by default in C/C++ but
enabled by default in Fortran. Ideally, we should express this
}
-static void
-gfc_handle_coarray_option (const char *arg)
-{
- if (strcmp (arg, "none") == 0)
- gfc_option.coarray = GFC_FCOARRAY_NONE;
- else if (strcmp (arg, "single") == 0)
- gfc_option.coarray = GFC_FCOARRAY_SINGLE;
- else if (strcmp (arg, "lib") == 0)
- gfc_option.coarray = GFC_FCOARRAY_LIB;
- else
- gfc_fatal_error ("Argument to %<-fcoarray%> is not valid: %s", arg);
-}
-
-
static void
gfc_handle_runtime_check_option (const char *arg)
{
case OPT_finit_local_zero:
gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
gfc_option.flag_init_integer_value = 0;
- gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
+ flag_init_real = GFC_INIT_REAL_ZERO;
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
gfc_option.flag_init_character_value = (char)0;
arg);
break;
- case OPT_finit_real_:
- if (!strcasecmp (arg, "zero"))
- gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
- else if (!strcasecmp (arg, "nan"))
- gfc_option.flag_init_real = GFC_INIT_REAL_NAN;
- else if (!strcasecmp (arg, "snan"))
- gfc_option.flag_init_real = GFC_INIT_REAL_SNAN;
- else if (!strcasecmp (arg, "inf"))
- gfc_option.flag_init_real = GFC_INIT_REAL_INF;
- else if (!strcasecmp (arg, "-inf"))
- gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
- else
- gfc_fatal_error ("Unrecognized option to %<-finit-real%>: %s",
- arg);
- break;
-
case OPT_finit_integer_:
gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
gfc_option.flag_init_integer_value = atoi (arg);
/* Handled in language-independent code. */
break;
- case OPT_fconvert_little_endian:
- gfc_option.convert = GFC_CONVERT_LITTLE;
- break;
-
- case OPT_fconvert_big_endian:
- gfc_option.convert = GFC_CONVERT_BIG;
- break;
-
- case OPT_fconvert_native:
- gfc_option.convert = GFC_CONVERT_NATIVE;
- break;
-
- case OPT_fconvert_swap:
- gfc_option.convert = GFC_CONVERT_SWAP;
- break;
-
case OPT_fcheck_:
gfc_handle_runtime_check_option (arg);
break;
-
- case OPT_fcoarray_:
- gfc_handle_coarray_option (arg);
- break;
}
Fortran_handle_option_auto (&global_options, &global_options_set,
if (t)
expression_rank (e);
- if (t && gfc_option.coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
+ if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
add_caf_get_intrinsic (e);
return t;
char name[GFC_MAX_SYMBOL_LEN];
static int serial = 0;
- if (gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (flag_coarray != GFC_FCOARRAY_LIB)
return;
symtree = gfc_find_symtree (gfc_current_ns->sym_root,
the LHS is (re)allocatable or has a vector subscript. If the LHS is a
noncoindexed array and the RHS is a coindexed scalar, use the normal code
path. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& (lhs_coindexed
|| (code->expr2->expr_type == EXPR_FUNCTION
&& code->expr2->value.function.isym
break;
case BT_REAL:
- switch (gfc_option.flag_init_real)
+ switch (flag_init_real)
{
case GFC_INIT_REAL_SNAN:
init_expr->is_snan = 1;
break;
case BT_COMPLEX:
- switch (gfc_option.flag_init_real)
+ switch (flag_init_real)
{
case GFC_INIT_REAL_SNAN:
init_expr->is_snan = 1;
/* The last dimension of an assumed-size array is special. */
if ((!coarray && d == as->rank && as->type == AS_ASSUMED_SIZE && !upper)
|| (coarray && d == as->rank + as->corank
- && (!upper || gfc_option.coarray == GFC_FCOARRAY_SINGLE)))
+ && (!upper || flag_coarray == GFC_FCOARRAY_SINGLE)))
{
if (as->lower[d-1]->expr_type == EXPR_CONSTANT)
{
{
gfc_expr *result;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return &gfc_bad_expr;
}
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE)
return NULL;
if (failed && failed->expr_type != EXPR_CONSTANT)
gcc_assert (sub_cons == NULL);
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE && !first_image)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE && !first_image)
return NULL;
result = gfc_get_constant_expr (BT_INTEGER, gfc_default_integer_kind,
gfc_simplify_this_image (gfc_expr *coarray, gfc_expr *dim,
gfc_expr *distance ATTRIBUTE_UNUSED)
{
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE)
return NULL;
/* If no coarray argument has been passed or when the first argument
type = TREE_TYPE (desc);
gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
- gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+ gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
field = gfc_advance_chain (TYPE_FIELDS (type), CAF_TOKEN_FIELD);
/* Should be a restricted pointer - except in the finalization wrapper. */
pointer = gfc_conv_descriptor_data_get (se->expr);
STRIP_NOPS (pointer);
- if (coarray && gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (coarray && flag_coarray == GFC_FCOARRAY_LIB)
token = gfc_build_addr_expr (NULL_TREE,
gfc_conv_descriptor_token (se->expr));
the allocation status may not be changed. */
tmp = fold_build2_loc (input_location, MODIFY_EXPR, void_type_node,
var, build_int_cst (TREE_TYPE (var), 0));
- if (pstat != NULL_TREE && coarray && gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (pstat != NULL_TREE && coarray && flag_coarray == GFC_FCOARRAY_LIB)
{
tree cond;
tree stat = build_fold_indirect_ref_loc (input_location, pstat);
gfc_add_modify (&se->pre, new_field, old_field);
}
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (old_desc))
&& GFC_TYPE_ARRAY_AKIND (TREE_TYPE (old_desc))
== GFC_ARRAY_ALLOCATABLE)
if (!sym->attr.use_assoc
&& (sym->attr.save != SAVE_NONE || sym->attr.data
|| (sym->value && sym->ns->proc_name->attr.is_main_program)
- || (gfc_option.coarray == GFC_FCOARRAY_LIB
+ || (flag_coarray == GFC_FCOARRAY_LIB
&& sym->attr.codimension && !sym->attr.allocatable)))
TREE_STATIC (decl) = 1;
nest = (procns->proc_name->backend_decl != current_function_decl)
&& !sym->attr.contained;
- if (sym->attr.codimension && gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (sym->attr.codimension && flag_coarray == GFC_FCOARRAY_LIB
&& sym->as->type != AS_ASSUMED_SHAPE
&& GFC_TYPE_ARRAY_CAF_TOKEN (type) == NULL_TREE)
{
&& (sym->attr.save || sym->ns->proc_name->attr.is_main_program
|| flag_max_stack_var_size == 0
|| sym->attr.data || sym->ns->proc_name->attr.flavor == FL_MODULE)
- && (gfc_option.coarray != GFC_FCOARRAY_LIB
+ && (flag_coarray != GFC_FCOARRAY_LIB
|| !sym->attr.codimension || sym->attr.allocatable))
{
/* Add static initializer. For procedures, it is only needed if
/* Coarrays which are descriptorless or assumed-shape pass with
-fcoarray=lib the token and the offset as hidden arguments. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& ((f->sym->ts.type != BT_CLASS && f->sym->attr.codimension
&& !f->sym->attr.allocatable)
|| (f->sym->ts.type == BT_CLASS
TREE_NOTHROW (gfor_fndecl_associated) = 1;
/* Coarray library calls. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree pint_type, pppchar_type;
if (CLASS_DATA (sym)->attr.dimension
|| (CLASS_DATA (sym)->attr.codimension
- && gfc_option.coarray != GFC_FCOARRAY_LIB))
+ && flag_coarray != GFC_FCOARRAY_LIB))
{
tmp = gfc_class_data_get (sym->backend_decl);
tmp = gfc_build_null_descriptor (TREE_TYPE (tmp));
sym->attr.dimension, false))
return;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && sym->attr.codimension)
+ if (flag_coarray == GFC_FCOARRAY_LIB && sym->attr.codimension)
return;
/* Create the decl for the variable or constant. */
gfc_traverse_ns (ns, gfc_create_module_variable);
gfc_traverse_ns (ns, create_module_nml_decl);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
+ if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
cur_module = NULL;
/* Call some libgfortran initialization routines, call then MAIN__(). */
/* Call _gfortran_caf_init (*argc, ***argv). */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree pint_type, pppchar_type;
pint_type = build_pointer_type (integer_type_node);
/* If this is the main program and an -fconvert option was provided,
add a call to set_convert. */
- if (gfc_option.convert != GFC_CONVERT_NATIVE)
+ if (flag_convert != GFC_FLAG_CONVERT_NATIVE)
{
tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_convert, 1,
- build_int_cst (integer_type_node,
- gfc_option.convert));
+ build_int_cst (integer_type_node, flag_convert));
gfc_add_expr_to_block (&body, tmp);
}
TREE_USED (fndecl) = 1;
/* Coarray: Call _gfortran_caf_finalize(void). */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
/* Per F2008, 8.5.1 END of the main program implies a
SYNC MEMORY. */
has_coarray_vars = false;
generate_local_vars (ns);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
+ if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
/* Keep the parent fake result declaration in module functions
If there are static coarrays in this function, the nested _caf_init
function has already called cgraph_create_node, which also created
the cgraph node for this function. */
- if (!has_coarray_vars || gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (!has_coarray_vars || flag_coarray != GFC_FCOARRAY_LIB)
(void) cgraph_node::create (fndecl);
}
else
generate_local_vars (ns);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
+ if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
decl = saved_local_decls;
/* For descriptorless coarrays and assumed-shape coarray dummies, we
pass the token and the offset as additional arguments. */
- if (fsym && e == NULL && gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (fsym && e == NULL && flag_coarray == GFC_FCOARRAY_LIB
&& ((fsym->ts.type != BT_CLASS && fsym->attr.codimension
&& !fsym->attr.allocatable)
|| (fsym->ts.type == BT_CLASS
vec_safe_push (stringargs, build_int_cst (gfc_array_index_type, 0));
gcc_assert (fsym->attr.optional);
}
- else if (fsym && gfc_option.coarray == GFC_FCOARRAY_LIB
+ else if (fsym && flag_coarray == GFC_FCOARRAY_LIB
&& ((fsym->ts.type != BT_CLASS && fsym->attr.codimension
&& !fsym->attr.allocatable)
|| (fsym->ts.type == BT_CLASS
tree caf_decl, token, offset, image_index, tmp;
tree res_var, dst_var, type, kind, vec;
- gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+ gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
if (se->ss && se->ss->info->useflags)
{
tree lhs_type = NULL_TREE;
tree vec = null_pointer_node, rhs_vec = null_pointer_node;
- gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+ gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
lhs_expr = code->ext.actual->expr;
rhs_expr = code->ext.actual->next->expr;
distance = expr->value.function.actual->expr;
/* The case -fcoarray=single is handled elsewhere. */
- gcc_assert (gfc_option.coarray != GFC_FCOARRAY_SINGLE);
+ gcc_assert (flag_coarray != GFC_FCOARRAY_SINGLE);
/* Argument-free version: THIS_IMAGE(). */
if (distance || expr->value.function.actual->expr == NULL)
/* Return 0 if "coindex" exceeds num_images(). */
- if (gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ if (flag_coarray == GFC_FCOARRAY_SINGLE)
num_images = build_int_cst (type, 1);
else
{
where size is the product of the extent of all but the last
codimension. */
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE && corank > 1)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE && corank > 1)
{
tree cosize;
resbound = fold_build2_loc (input_location, PLUS_EXPR,
gfc_array_index_type, resbound, tmp);
}
- else if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ else if (flag_coarray != GFC_FCOARRAY_SINGLE)
{
/* ubound = lbound + num_images() - 1. */
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_num_images,
case GFC_ISYM_THIS_IMAGE:
/* For num_images() == 1, handle as LCOBOUND. */
if (expr->value.function.actual->expr
- && gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ && flag_coarray == GFC_FCOARRAY_SINGLE)
conv_intrinsic_cobound (se, expr);
else
trans_this_image (se, expr);
gfc_add_block_to_block (&block, &argse.pre);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE)
stat = gfc_build_addr_expr (NULL_TREE, stat);
}
- else if (gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ else if (flag_coarray == GFC_FCOARRAY_SINGLE)
stat = NULL_TREE;
else
stat = null_pointer_node;
/* Early exit for GFC_FCOARRAY_SINGLE. */
- if (gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ if (flag_coarray == GFC_FCOARRAY_SINGLE)
{
if (stat != NULL_TREE)
gfc_add_modify (&block, stat,
atom = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& code->ext.actual->next->expr->ts.kind == atom_expr->ts.kind)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->expr);
case GFC_ISYM_ATOMIC_OR:
case GFC_ISYM_ATOMIC_XOR:
stat_expr = code->ext.actual->next->next->expr;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
old = null_pointer_node;
break;
default:
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
{
gcc_assert (stat_expr->expr_type == EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr_val (&argse, stat_expr);
gfc_add_block_to_block (&block, &argse.pre);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ else if (flag_coarray == GFC_FCOARRAY_LIB)
stat = null_pointer_node;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree image_index, caf_decl, offset, token;
int op;
atom = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& code->ext.actual->expr->ts.kind == atom_expr->ts.kind)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->expr);
gcc_assert (code->ext.actual->next->next->expr->expr_type
== EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr_val (&argse, code->ext.actual->next->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ else if (flag_coarray == GFC_FCOARRAY_LIB)
stat = null_pointer_node;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree image_index, caf_decl, offset, token;
tree orig_value = NULL_TREE, vardecl = NULL_TREE;
atom = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
old = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
comp = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& code->ext.actual->next->next->next->expr->ts.kind
== atom_expr->ts.kind)
argse.want_pointer = 1;
gcc_assert (code->ext.actual->next->next->next->next->expr->expr_type
== EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr_val (&argse,
code->ext.actual->next->next->next->next->expr);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ else if (flag_coarray == GFC_FCOARRAY_LIB)
stat = null_pointer_node;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree image_index, caf_decl, offset, token;
/* For coarrays, call SYNC ALL if TO is already deallocated as MOVE_ALLOC
is an image control "statement", cf. IR F08/0040 in 12-006A. */
- if (coarray && gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (coarray && flag_coarray == GFC_FCOARRAY_LIB)
{
tree cond;
gfc_init_se (&se, NULL);
gfc_start_block (&se.pre);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && !error_stop)
+ if (flag_coarray == GFC_FCOARRAY_LIB && !error_stop)
{
/* Per F2008, 8.5.1 STOP implies a SYNC MEMORY. */
tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
tmp = build_int_cst (gfc_int4_type_node, 0);
tmp = build_call_expr_loc (input_location,
error_stop
- ? (gfc_option.coarray == GFC_FCOARRAY_LIB
+ ? (flag_coarray == GFC_FCOARRAY_LIB
? gfor_fndecl_caf_error_stop_str
: gfor_fndecl_error_stop_string)
: gfor_fndecl_stop_string,
gfc_conv_expr (&se, code->expr1);
tmp = build_call_expr_loc (input_location,
error_stop
- ? (gfc_option.coarray == GFC_FCOARRAY_LIB
+ ? (flag_coarray == GFC_FCOARRAY_LIB
? gfor_fndecl_caf_error_stop
: gfor_fndecl_error_stop_numeric)
: gfor_fndecl_stop_numeric_f08, 1,
gfc_conv_expr_reference (&se, code->expr1);
tmp = build_call_expr_loc (input_location,
error_stop
- ? (gfc_option.coarray == GFC_FCOARRAY_LIB
+ ? (flag_coarray == GFC_FCOARRAY_LIB
? gfor_fndecl_caf_error_stop_str
: gfor_fndecl_error_stop_string)
: gfor_fndecl_stop_string,
/* Short cut: For single images without STAT= or LOCK_ACQUIRED
return early. (ERRMSG= is always untouched for -fcoarray=single.) */
- if (!code->expr2 && !code->expr4 && gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (!code->expr2 && !code->expr4 && flag_coarray != GFC_FCOARRAY_LIB)
return NULL_TREE;
gfc_init_se (&se, NULL);
/* Short cut: For single images without bound checking or without STAT=,
return early. (ERRMSG= is always untouched for -fcoarray=single.) */
if (!code->expr2 && !(gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
- && gfc_option.coarray != GFC_FCOARRAY_LIB)
+ && flag_coarray != GFC_FCOARRAY_LIB)
return NULL_TREE;
gfc_init_se (&se, NULL);
else
stat = null_pointer_node;
- if (code->expr3 && gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (code->expr3 && flag_coarray == GFC_FCOARRAY_LIB
&& type != EXEC_SYNC_MEMORY)
{
gcc_assert (code->expr3->expr_type == EXPR_VARIABLE);
errmsg = gfc_build_addr_expr (NULL, argse.expr);
errmsglen = argse.string_length;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB && type != EXEC_SYNC_MEMORY)
+ else if (flag_coarray == GFC_FCOARRAY_LIB && type != EXEC_SYNC_MEMORY)
{
errmsg = null_pointer_node;
errmsglen = build_int_cst (integer_type_node, 0);
&& code->expr1->rank == 0)
{
tree cond;
- if (gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (flag_coarray != GFC_FCOARRAY_LIB)
cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
images, build_int_cst (TREE_TYPE (images), 1));
else
/* Per F2008, 8.5.1, a SYNC MEMORY is implied by calling the
image control statements SYNC IMAGES and SYNC ALL. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
tmp = build_call_expr_loc (input_location, tmp, 0);
gfc_add_expr_to_block (&se.pre, tmp);
}
- if (gfc_option.coarray != GFC_FCOARRAY_LIB || type == EXEC_SYNC_MEMORY)
+ if (flag_coarray != GFC_FCOARRAY_LIB || type == EXEC_SYNC_MEMORY)
{
/* Set STAT to zero. */
if (code->expr2)
gfc_start_block (&block);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
token = gfc_get_symbol_decl (code->resolved_sym);
token = GFC_TYPE_ARRAY_CAF_TOKEN (TREE_TYPE (token));
tmp = gfc_trans_code (code->block->next);
gfc_add_expr_to_block (&block, tmp);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_unlock, 6,
token, integer_zero_node, integer_one_node,
if (as->rank == 0)
{
- if (packed != PACKED_STATIC || gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (packed != PACKED_STATIC || flag_coarray == GFC_FCOARRAY_LIB)
{
type = build_pointer_type (type);
}
if (packed != PACKED_STATIC || !known_stride
- || (as->corank && gfc_option.coarray == GFC_FCOARRAY_LIB))
+ || (as->corank && flag_coarray == GFC_FCOARRAY_LIB))
{
/* For dummy arrays and automatic (heap allocated) arrays we
want a pointer to the array. */
gcc_assert (codimen + dimen >= 0 && codimen + dimen <= GFC_MAX_DIMENSIONS);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && codimen)
+ if (flag_coarray == GFC_FCOARRAY_LIB && codimen)
{
if (gfc_array_descriptor_base_caf[idx])
return gfc_array_descriptor_base_caf[idx];
TREE_NO_WARNING (decl) = 1;
}
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && codimen
+ if (flag_coarray == GFC_FCOARRAY_LIB && codimen
&& akind == GFC_ARRAY_ALLOCATABLE)
{
decl = gfc_add_field_to_struct_1 (fat_type,
gfc_finish_type (fat_type);
TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (fat_type)) = 1;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && codimen
+ if (flag_coarray == GFC_FCOARRAY_LIB && codimen
&& akind == GFC_ARRAY_ALLOCATABLE)
gfc_array_descriptor_base_caf[idx] = fat_type;
else
gfc_allocate_using_lib. */
gfc_start_block (&alloc_block);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& gfc_expr_attr (expr).codimension)
{
tree cond;
/* When POINTER is not NULL, we free it. */
gfc_start_block (&non_null);
gfc_add_finalizer_call (&non_null, expr);
- if (!coarray || gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (!coarray || flag_coarray != GFC_FCOARRAY_LIB)
{
tmp = build_call_expr_loc (input_location,
builtin_decl_explicit (BUILT_IN_FREE), 1,