From: Tobias Burnus Date: Wed, 17 Dec 2014 06:29:30 +0000 (+0100) Subject: re PR fortran/54687 (Use gcc option machinery for gfortran) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f19626cf3086867bd69b25c5113e159289107ce4;p=gcc.git re PR fortran/54687 (Use gcc option machinery for gfortran) 2014-12-17 Tobias Burnus PR fortran/54687 gcc/ * flag-types.h (gfc_init_local_real, gfc_fcoarray, gfc_convert): New enums; moved from fortran/. gcc/fortran/ * 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. From-SVN: r218808 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 54e7aa90a92..461b03220cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-12-17 Tobias Burnus + + PR fortran/54687 + * flag-types.h (gfc_init_local_real, gfc_fcoarray, + gfc_convert): New enums; moved from fortran/. + 2014-12-16 Jan Hubicka * fibonacci_heap.h (min): Return m_data instead of non-existing data. diff --git a/gcc/flag-types.h b/gcc/flag-types.h index 52ff7eec257..81e8fb8d4da 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -263,4 +263,38 @@ enum lto_partition_model { 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 */ diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e6ab2a8f01c..3f20d0a7649 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,28 @@ +2014-12-17 Tobias Burnus + + 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 PR fortran/54687 diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index e88ba668adb..e60b938a174 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -208,7 +208,7 @@ coarray: 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; @@ -591,7 +591,7 @@ coarray: 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; diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 527123df725..95c5223de65 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -1481,7 +1481,7 @@ check_co_collective (gfc_expr *a, gfc_expr *image_idx, gfc_expr *stat, } } - 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); @@ -2569,7 +2569,7 @@ gfc_check_lbound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind) 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; @@ -4847,7 +4847,7 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub) { 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; @@ -4885,7 +4885,7 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub) 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; @@ -4927,7 +4927,7 @@ gfc_check_num_images (gfc_expr *distance, gfc_expr *failed) 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; @@ -5126,7 +5126,7 @@ gfc_check_ubound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind) 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; diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 0f8b2be5965..41c6c5725ea 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -599,18 +599,6 @@ enum gfc_isym_id }; 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, @@ -633,14 +621,6 @@ typedef enum } init_local_integer; -typedef enum -{ - GFC_FCOARRAY_NONE = 0, - GFC_FCOARRAY_SINGLE, - GFC_FCOARRAY_LIB -} -gfc_fcoarray; - typedef enum { GFC_ENABLE_REVERSE, @@ -2436,7 +2416,6 @@ typedef struct 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; @@ -2444,11 +2423,9 @@ typedef struct int fpe; int fpe_summary; int rtcheck; - gfc_fcoarray coarray; int warn_std; int allow_std; - int convert; } gfc_option_t; diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt index 1e84c69053e..95be3658e4f 100644 --- a/gcc/fortran/lang.opt +++ b/gcc/fortran/lang.opt @@ -381,21 +381,24 @@ fcheck-array-temporaries 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= 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) @@ -518,8 +521,26 @@ Fortran RejectNegative Joined -finit-logical= Initialize local logical variables finit-real= -Fortran RejectNegative Joined --finit-real= Initialize local real variables +Fortran RejectNegative ToLower Joined Enum(gfc_init_local_real) Var(flag_init_real) Init(GFC_INIT_REAL_OFF) +-finit-real= 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) @@ -614,8 +635,20 @@ Fortran Var(flag_repack_arrays) 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= 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 diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h index dda755b142b..e8ac92698f9 100644 --- a/gcc/fortran/libgfortran.h +++ b/gcc/fortran/libgfortran.h @@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see /* 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, diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 0a2fb0dd95f..fb68eec6ee8 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1663,7 +1663,7 @@ gfc_match_critical (void) 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"); @@ -2725,7 +2725,7 @@ lock_unlock_statement (gfc_statement st) 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; @@ -2921,7 +2921,7 @@ sync_statement (gfc_statement st) 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"); diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 5dcb5d84b09..307688a1b69 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -84,14 +84,12 @@ gfc_init_options (unsigned int decoded_options_count, 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; @@ -102,7 +100,6 @@ gfc_init_options (unsigned int decoded_options_count, | 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 @@ -468,20 +465,6 @@ gfc_handle_fpe_option (const char *arg, bool trap) } -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) { @@ -596,7 +579,7 @@ gfc_handle_option (size_t scode, const char *arg, int value, 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; @@ -612,22 +595,6 @@ gfc_handle_option (size_t scode, const char *arg, int value, 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); @@ -712,29 +679,9 @@ gfc_handle_option (size_t scode, const char *arg, int value, /* 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, diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 7ee0bab00be..3b8b8695bc1 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5091,7 +5091,7 @@ resolve_procedure: 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; @@ -8526,7 +8526,7 @@ resolve_critical (gfc_code *code) 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, @@ -9398,7 +9398,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns) 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 @@ -10689,7 +10689,7 @@ build_default_init_expr (gfc_symbol *sym) break; case BT_REAL: - switch (gfc_option.flag_init_real) + switch (flag_init_real) { case GFC_INIT_REAL_SNAN: init_expr->is_snan = 1; @@ -10718,7 +10718,7 @@ build_default_init_expr (gfc_symbol *sym) break; case BT_COMPLEX: - switch (gfc_option.flag_init_real) + switch (flag_init_real) { case GFC_INIT_REAL_SNAN: init_expr->is_snan = 1; diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 26eb2e577bc..d46c5dbee74 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -3324,7 +3324,7 @@ simplify_bound_dim (gfc_expr *array, gfc_expr *kind, int d, int upper, /* 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) { @@ -4633,13 +4633,13 @@ gfc_simplify_num_images (gfc_expr *distance ATTRIBUTE_UNUSED, gfc_expr *failed) { 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) @@ -6525,7 +6525,7 @@ gfc_simplify_image_index (gfc_expr *coarray, gfc_expr *sub) 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, @@ -6543,7 +6543,7 @@ gfc_expr * 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 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 8f0baa62fcd..e061dcf766a 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -298,7 +298,7 @@ gfc_conv_descriptor_token (tree desc) 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. */ @@ -5277,7 +5277,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, 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)); @@ -5360,7 +5360,7 @@ gfc_array_deallocate (tree descriptor, tree pstat, tree errmsg, tree errlen, 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); @@ -7264,7 +7264,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77, 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) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f6286d4c509..494d8aa905e 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -626,7 +626,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym) 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; @@ -814,7 +814,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) 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) { @@ -1548,7 +1548,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) && (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 @@ -2301,7 +2301,7 @@ create_function_arglist (gfc_symbol * sym) /* 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 @@ -3327,7 +3327,7 @@ gfc_build_builtin_function_decls (void) 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; @@ -3890,7 +3890,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) 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)); @@ -4683,7 +4683,7 @@ gfc_emit_parameter_debug_info (gfc_symbol *sym) 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. */ @@ -4873,7 +4873,7 @@ gfc_generate_module_vars (gfc_namespace * ns) 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; @@ -5372,7 +5372,7 @@ create_main_function (tree fndecl) /* 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); @@ -5476,12 +5476,11 @@ create_main_function (tree fndecl) /* 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); } @@ -5515,7 +5514,7 @@ create_main_function (tree fndecl) 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. */ @@ -5705,7 +5704,7 @@ gfc_generate_function_code (gfc_namespace * ns) 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 @@ -5895,7 +5894,7 @@ gfc_generate_function_code (gfc_namespace * ns) 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 @@ -6026,7 +6025,7 @@ gfc_process_block_locals (gfc_namespace* ns) 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; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 39cfb2f7e4e..7772dcafa49 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -4999,7 +4999,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, /* 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 @@ -5011,7 +5011,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, 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 diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 8fefe308bc3..0cce3cb3980 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1106,7 +1106,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, 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) { @@ -1236,7 +1236,7 @@ conv_caf_send (gfc_code *code) { 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; @@ -1404,7 +1404,7 @@ trans_this_image (gfc_se * se, gfc_expr *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) @@ -1716,7 +1716,7 @@ trans_image_index (gfc_se * se, gfc_expr *expr) /* 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 { @@ -2098,7 +2098,7 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr) 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; @@ -2116,7 +2116,7 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr) 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, @@ -8137,7 +8137,7 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr) 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); @@ -8592,16 +8592,16 @@ conv_co_collective (gfc_code *code) 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, @@ -8761,7 +8761,7 @@ conv_intrinsic_atomic_op (gfc_code *code) 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); @@ -8777,12 +8777,12 @@ conv_intrinsic_atomic_op (gfc_code *code) 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); @@ -8796,17 +8796,17 @@ conv_intrinsic_atomic_op (gfc_code *code) { 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; @@ -8960,7 +8960,7 @@ conv_intrinsic_atomic_ref (gfc_code *code) 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); @@ -8974,17 +8974,17 @@ conv_intrinsic_atomic_ref (gfc_code *code) 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; @@ -9061,7 +9061,7 @@ conv_intrinsic_atomic_cas (gfc_code *code) 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); @@ -9069,7 +9069,7 @@ conv_intrinsic_atomic_cas (gfc_code *code) 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); @@ -9077,7 +9077,7 @@ conv_intrinsic_atomic_cas (gfc_code *code) 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; @@ -9092,7 +9092,7 @@ conv_intrinsic_atomic_cas (gfc_code *code) 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); @@ -9100,10 +9100,10 @@ conv_intrinsic_atomic_cas (gfc_code *code) 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; @@ -9357,7 +9357,7 @@ conv_intrinsic_move_alloc (gfc_code *code) /* 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; diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 8eda2d88ee2..47edd327d0c 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -627,7 +627,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop) 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); @@ -643,7 +643,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop) 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, @@ -654,7 +654,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop) 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, @@ -665,7 +665,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop) 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, @@ -688,7 +688,7 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op type ATTRIBUTE_UNUSED) /* 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); @@ -733,7 +733,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) /* 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); @@ -756,7 +756,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) 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); @@ -766,7 +766,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) 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); @@ -778,7 +778,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) && 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 @@ -803,14 +803,14 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type) /* 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) @@ -1115,7 +1115,7 @@ gfc_trans_critical (gfc_code *code) 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)); @@ -1129,7 +1129,7 @@ gfc_trans_critical (gfc_code *code) 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, diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 07593e55bcb..9bf08038efd 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1648,7 +1648,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed, 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); @@ -1702,7 +1702,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed, } 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. */ @@ -1734,7 +1734,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted, 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]; @@ -1782,7 +1782,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted, 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, @@ -1795,7 +1795,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted, 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 diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 76fe7fd6e03..7c54b8e2499 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -772,7 +772,7 @@ gfc_allocate_allocatable (stmtblock_t * block, tree mem, tree size, tree token, 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; @@ -1263,7 +1263,7 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg, /* 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,