aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNicolas KÃnig <koenigni@student.ethz.ch>2020-10-18 13:37:30 +0200
committerNicolas KÃnig <koenigni@student.ethz.ch>2020-10-18 13:44:33 +0200
commit7488585fc18a9466253617e251c0e0bdc168a3b1 (patch)
tree7d0d2faf6c03746ccdd2cf409022ae0d20866751 /gcc
parentb96fdc7b84eb288dea0c3e99a212e6483007a35a (diff)
downloadgcc-7488585fc18a9466253617e251c0e0bdc168a3b1.zip
gcc-7488585fc18a9466253617e251c0e0bdc168a3b1.tar.gz
gcc-7488585fc18a9466253617e251c0e0bdc168a3b1.tar.bz2
Implement comments from review.
This implements the comments from the review - the general prefix is now cas (for coarray shared), and native has been renamed to shared generally. Plus, there is a lot of cleanup such as removing dead code and debug statements. gcc/ChangeLog: PR fortran/88076 * flag-types.h (enum gfc_fcoarray): Change GFC_FCOARRAY_NATIVE to GFC_FCOARRAY_SHARED. gcc/fortran/ChangeLog: PR fortran/88076 * dump-parse-tree.c (show_symbol): Remove dumping of backend_decl. * frontend-passes.c (gfc_run_passes): Generally rename "native" to "shared" and "cas" instead of "nca". (co_reduce_code): Initialize num. Generally rename "native" to "shared" and "cas" instead of "nca". * gfortran.h: Generally rename "native" to "shared". * iresolve.c (gfc_resolve_co_collective): Use specific function for library coarrays. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_resolve_co_reduce): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_resolve_co_broadcast): Generally rename "native" to "shared" and "cas" instead of "nca". * lang.opt: Generally rename "native" to "shared" and "cas" instead of "nca". * resolve.c (fixup_coarray_args): Rename to (fixup_shared_coarray_args): Generally rename "native" to "shared" and "cas" instead of "nca". Get rid of a variable. (resolve_unknown_s): Fix whitespace. (resolve_call): Generally rename "native" to "shared" and "cas" instead of "nca". (resolve_critical): Revert spurious change. Generally rename "native" to "shared" and "cas" instead of "nca". * trans-array.c (gfc_add_strides): Fix comment format. (gfc_native_coarray_add_this_image_offset): Generally rename "native" to "shared" and "cas" instead of "nca". Formatting fixes. (gfc_conv_ss_descriptor): Generally rename "native" to "shared" and "cas" instead of "nca". (build_array_ref): Remove empty line. (gfc_conv_array_ref): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_array_init_size): Special-case GFC_COARRAY_SHARED. Generally rename "native" to "shared" and "cas" instead of "nca". Fix formatting. (gfc_allocate_native_coarray): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_array_allocate): Generally rename "native" to "shared" and "cas" instead of "nca". Fix comment syntax. (gfc_trans_dummy_array_bias): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_dataptr_offset): Generally rename "native" to "shared" and "cas" instead of "nca". Fix comment style. (gfc_conv_expr_descriptor): Remove code blocks guarded by #if 0 or #if 1. (gfc_conv_array_parameter): Likewise. (gfc_walk_array_ref): Likewise. * trans-array.h (enum gfc_coarray_allocation_type): Change offset from 3 to 1. * trans-decl.c: Generally rename "native" to "shared" and "cas" instead of "nca" for tree declarations. (gfc_build_qualified_array): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_build_dummy_array_decl): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_symbol_decl): Revert spurious change. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_build_builtin_function_decls): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_native_coarray): Clarify comment. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_deferred_vars): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_create_module_variable): Generally rename "native" to "shared" and "cas" instead of "nca". (generate_coarray_constructor_function): Generally rename "native" to "shared" and "cas" instead of "nca". (create_main_function): Generally rename "native" to "shared" and "cas" instead of "nca". * trans-expr.c (gfc_maybe_dereference_var): Remove branch where condition is always false. Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_conv_procedure_call): Remove code blocks guarded by #if 0. Whitespace fix. * trans-intrinsic.c (trans_this_image): Generally rename "native" to "shared" and "cas" instead of "nca". (trans_image_index): Remove unneeded TODO. Generally rename "native" to "shared" and "cas" instead of "nca". (trans_num_images): Generally rename "native" to "shared" and "cas" instead of "nca". (conv_intrinsic_cobound): Generally rename "native" to "shared" and "cas" instead of "nca". (trans_argument): Clarify comment explaining what the function does. (conv_nca_reduce): Rename to... (conv_cas_reduce): this. Add comment. (conv_nca_broadcast): Rename to... (conv_cas_broadcast): this. (conv_nca_collective): Rename to... (conv_cas_collective): this. (conv_co_collective): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_conv_intrinsic_subroutine): Generally rename "native" to "shared" and "cas" instead of "nca". * trans-stmt.c (gfc_trans_lock_unlock): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_sync): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_critical): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_trans_deallocate): Generally rename "native" to "shared" and "cas" instead of "nca". * trans-types.c (gfc_is_nodesc_array): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_build_array_type): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_nodesc_array_type): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_get_array_type_bounds): Generally rename "native" to "shared" and "cas" instead of "nca". * trans.c (gfc_trans_memory_barrier): Use sizeof instead of strlen, replace comma by semicolon. (gfc_build_array_ref): Generally rename "native" to "shared" and "cas" instead of "nca". (gfc_deallocate_with_status): Fix indentation. Generally rename "native" to "shared" and "cas" instead of "nca". * trans.h: Generally rename "native" to "shared" and "cas" instead of "nca". libgfortran/ChangeLog: PR fortran/88076 * m4/nca-minmax-s.m4: Change "nca" prefix to "cas". Add comments. * m4/nca_minmax.m4: Likewise. * nca/README.native_coarrays: Update. * nca/alloc.c (free_memory_with_id): Add FIXME. * nca/coarraynative.c (nca_master): Rename to (cas_master): Change logic for exiting images. * nca/collective_subroutine.c (get_collsub_buf): Add comment. (collsub_sync): Remove dead debug output. (collsub_reduce_array): Silence -Wsign-compare warning. (collsub_iface_init): Remove unused variable. (collsub_broadcast_scalar): Remove debug code. (collsub_broadcast_array): Remove unused variable. (nca_co_broadcast): Remove commented-out function, plus its (export_proto): prototype declaration. * nca/collective_subroutine.h (finish_collective_subroutine): Add. * nca/hashmap.c (num_entries): Silcence -Wsign-compare warning. (hash): Formatting change (add empty lines). (gen_mask): Likewise. (hmiadd): Likewise. (get_expected_offset): Likewise. (hashmap_init): Likewise. (scan_empty): Likewise. Remove unused argument. (hashmap_get): Formatting change (add empty lines). (hm_search_result_ptr): Likewise. (hm_search_result_contains): Likewise. (enlarge_hashmap_mem): Likewise. (resize_hm): Likewise. Remove argument in call to scan_empty. (hashmap_set): Remove dead debugging code. Silence -Wsign-compare warning. (hashmap_change_refcnt): Silence -Wsign-compare warning. (hashmap_inc): Formatting change. * nca/hashmap.h (Library): Add copyright notice. * nca/libcoarraynative.h (DEBUG_NATIVE_COARRAY): #define as 0 (NUM_ADDR_BITS): Remove dead code. (nca_master): Rename to (cas_master): this. * nca/shared_memory.c (shared_memory_get_mem_with_alignment): Remove debug code. * nca/shared_memory.h (SHARED_MEMORY_H): Move definition to start of file. * nca/sync.c (get_locked_table): Remove commented-out code. (sync_iface_init): Remove debug code. (sync_all): Remove debug code. * nca/sync.h: Add space after #include. * nca/util.c: Include assert.h. Add comment. (next_power_of_two): Remove comment. (pack_array_finish): Replace 0 by '\0' in memset. (unpack_array_finish): Zero variable count. * nca/wrapper.c (enum gfc_coarray_allocation_type): Enum starts at one. Add comment about need to keep in sync with trans-array.h. (nca_coarray_alloc): Rename to (cas_coarray_alloc): this. (nca_coarray_free): Rename to (cas_coarray_free): this. (nca_coarray_this_image): Rename to (cas_coarray_this_image): this. (nca_coarray_num_images): Rename to (cas_coarray_num_images): this. (nca_coarray_sync_all): Rename to (cas_coarray_sync_all): this. (nca_sync_images): Rename to (cas_sync_images): this. (nca_lock): Rename to (cas_lock): this. (nca_unlock): Rename to (cas_unlock): this. (nca_collsub_reduce_array): Rename to (cas_collsub_reduce_array): this. (nca_collsub_reduce_scalar): Rename to (cas_collsub_reduce_scalar): this. (nca_collsub_broadcast_array): Rename to (cas_collsub_broadcast_array): this. (nca_collsub_broadcast_scalar): Rename to (cas_collsub_broadcast_scalar): this. * nca/.tags: Delete. * nca/collective_inline.h: Delete. * generated/nca_minmax_i1.c: Regenerated. * generated/nca_minmax_i16.c: Regenerated. * generated/nca_minmax_i2.c: Regenerated. * generated/nca_minmax_i4.c: Regenerated. * generated/nca_minmax_i8.c: Regenerated. * generated/nca_minmax_r10.c: Regenerated. * generated/nca_minmax_r16.c: Regenerated. * generated/nca_minmax_r4.c: Regenerated. * generated/nca_minmax_r8.c: Regenerated. * generated/nca_minmax_s1.c: Regenerated. * generated/nca_minmax_s4.c: Regenerated.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/flag-types.h2
-rw-r--r--gcc/fortran/dump-parse-tree.c2
-rw-r--r--gcc/fortran/frontend-passes.c4
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/iresolve.c21
-rw-r--r--gcc/fortran/lang.opt2
-rw-r--r--gcc/fortran/resolve.c26
-rw-r--r--gcc/fortran/trans-array.c121
-rw-r--r--gcc/fortran/trans-array.h3
-rw-r--r--gcc/fortran/trans-decl.c115
-rw-r--r--gcc/fortran/trans-expr.c21
-rw-r--r--gcc/fortran/trans-intrinsic.c61
-rw-r--r--gcc/fortran/trans-stmt.c46
-rw-r--r--gcc/fortran/trans-types.c12
-rw-r--r--gcc/fortran/trans.c23
-rw-r--r--gcc/fortran/trans.h24
16 files changed, 241 insertions, 244 deletions
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index 51e698d..d0659c6 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -347,7 +347,7 @@ enum gfc_fcoarray
GFC_FCOARRAY_NONE = 0,
GFC_FCOARRAY_SINGLE,
GFC_FCOARRAY_LIB,
- GFC_FCOARRAY_NATIVE
+ GFC_FCOARRAY_SHARED
};
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index acff75a..591df8c 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -1060,7 +1060,7 @@ show_symbol (gfc_symbol *sym)
if (sym == NULL)
return;
- fprintf (dumpfile, "|| symbol: '%s' %p ", sym->name, (void *) &(sym->backend_decl));
+ fprintf (dumpfile, "|| symbol: '%s'", sym->name);
len = strlen (sym->name);
for (i=len; i<12; i++)
fputc(' ', dumpfile);
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index c573731..df850b0 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -181,7 +181,7 @@ gfc_run_passes (gfc_namespace *ns)
if (flag_realloc_lhs)
realloc_strings (ns);
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
rewrite_co_reduce (ns);
}
@@ -5917,7 +5917,7 @@ co_reduce_code (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, void *data)
gfc_code *assign;
gfc_expr *e1, *e2;
char name[GFC_MAX_SYMBOL_LEN + 1];
- static int num;
+ static int num = 0;
if (co->op != EXEC_CALL || co->resolved_isym == NULL
|| co->resolved_isym->id != GFC_ISYM_CO_REDUCE)
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 6940c24..3629545 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2010,7 +2010,7 @@ typedef struct gfc_array_ref
int dimen; /* # of components in the reference */
int codimen;
bool in_allocate; /* For coarray checks. */
- bool native_coarray_argument;
+ bool shared_coarray_arg;
gfc_expr *team;
gfc_expr *stat;
locus where;
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 844891e..1ec3dc5 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -4041,14 +4041,14 @@ gfc_resolve_co_collective (gfc_code *c, const char *oper)
gfc_expr *e;
const char *name;
- if (flag_coarray != GFC_FCOARRAY_NATIVE)
- name = gfc_get_string (PREFIX ("caf_co_sum"));
+ if (flag_coarray != GFC_FCOARRAY_SHARED)
+ name = gfc_get_string (PREFIX ("caf_co_%s"), oper);
else
{
e = c->ext.actual->expr;
kind = e->ts.kind;
- name = gfc_get_string (PREFIX ("nca_collsub_%s_%s_%c%d"), oper,
+ name = gfc_get_string (PREFIX ("cas_collsub_%s_%s_%c%d"), oper,
e->rank ? "array" : "scalar",
gfc_type_letter (e->ts.type), kind);
}
@@ -4056,6 +4056,9 @@ gfc_resolve_co_collective (gfc_code *c, const char *oper)
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
+/* All of these are needed, since they are treated seperately in the big
+ * intrinsic table. */
+
/* Resolve CO_SUM. */
void
@@ -4088,18 +4091,18 @@ gfc_resolve_co_reduce (gfc_code *c)
gfc_expr *e;
const char *name;
- if (flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (flag_coarray != GFC_FCOARRAY_SHARED)
name = gfc_get_string (PREFIX ("caf_co_reduce"));
else
{
e = c->ext.actual->expr;
if (e->ts.type == BT_CHARACTER)
- name = gfc_get_string (PREFIX ("nca_collsub_reduce_%s%c%d"),
+ name = gfc_get_string (PREFIX ("cas_collsub_reduce_%s%c%d"),
e->rank ? "array" : "scalar",
gfc_type_letter (e->ts.type), e->ts.kind);
else
- name = gfc_get_string (PREFIX ("nca_collsub_reduce_%s"),
+ name = gfc_get_string (PREFIX ("cas_collsub_reduce_%s"),
e->rank ? "array" : "scalar" );
}
@@ -4112,17 +4115,17 @@ gfc_resolve_co_broadcast (gfc_code * c)
gfc_expr *e;
const char *name;
- if (flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (flag_coarray != GFC_FCOARRAY_SHARED)
name = gfc_get_string (PREFIX ("caf_co_broadcast"));
else
{
e = c->ext.actual->expr;
if (e->ts.type == BT_CHARACTER)
- name = gfc_get_string (PREFIX ("nca_collsub_broadcast_%s%c%d"),
+ name = gfc_get_string (PREFIX ("cas_collsub_broadcast_%s%c%d"),
e->rank ? "array" : "scalar",
gfc_type_letter (e->ts.type), e->ts.kind);
else
- name = gfc_get_string (PREFIX ("nca_collsub_broadcast_%s"),
+ name = gfc_get_string (PREFIX ("cas_collsub_broadcast_%s"),
e->rank ? "array" : "scalar" );
}
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index 6180355..063f006 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -776,7 +776,7 @@ EnumValue
Enum(gfc_fcoarray) String(lib) Value(GFC_FCOARRAY_LIB)
EnumValue
-Enum(gfc_fcoarray) String(shared) Value(GFC_FCOARRAY_NATIVE)
+Enum(gfc_fcoarray) String(shared) Value(GFC_FCOARRAY_SHARED)
fcheck=
Fortran RejectNegative JoinedOrMissing
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6d6984b..7d772d5 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3585,22 +3585,24 @@ resolve_specific_s (gfc_code *c)
return false;
}
-/* Fix up references to native coarrays in call - element references
+
+/* Fix up references to shared coarrays in call - element references
have to be converted to full references if the coarray has to be
passed fully. */
static void
-fixup_coarray_args (gfc_symbol *sym, gfc_actual_arglist *actual)
+fixup_shared_coarray_args (gfc_symbol *sym, gfc_actual_arglist *actual)
{
- gfc_formal_arglist *formal, *f;
+ gfc_formal_arglist *f;
gfc_actual_arglist *a;
- formal = gfc_sym_get_dummy_args (sym);
+ a = actual;
+ f = gfc_sym_get_dummy_args (sym);
- if (formal == NULL)
+ if (f == NULL)
return;
- for (a = actual, f = formal; a && f; a = a->next, f = f->next)
+ for (; a && f; a = a->next, f = f->next)
{
if (a->expr == NULL || f->sym == NULL)
continue;
@@ -3626,7 +3628,7 @@ fixup_coarray_args (gfc_symbol *sym, gfc_actual_arglist *actual)
if (ar->type == AR_ELEMENT)
ar->type = !ar->dimen ? AR_FULL : AR_SECTION;
- ar->native_coarray_argument = true;
+ ar->shared_coarray_arg = true;
}
}
}
@@ -3662,7 +3664,7 @@ resolve_unknown_s (gfc_code *c)
found:
gfc_procedure_use (sym, &c->ext.actual, &c->loc);
-
+
c->resolved_sym = sym;
return pure_subroutine (sym, sym->name, &c->loc);
@@ -3787,8 +3789,8 @@ resolve_call (gfc_code *c)
/* Typebound procedure: Assume the worst. */
gfc_current_ns->proc_name->attr.array_outer_dependency = 1;
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
- fixup_coarray_args (csym, c->ext.actual);
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
+ fixup_shared_coarray_args (csym, c->ext.actual);
return t;
}
@@ -10167,7 +10169,7 @@ resolve_critical (gfc_code *code)
char name[GFC_MAX_SYMBOL_LEN];
static int serial = 0;
- if (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_SHARED)
return;
symtree = gfc_find_symtree (gfc_current_ns->sym_root,
@@ -10205,7 +10207,7 @@ resolve_critical (gfc_code *code)
NULL, 1);
gfc_commit_symbols();
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
{
gfc_ref *r = gfc_get_ref ();
r->type = REF_ARRAY;
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 9013f19..55a63e3 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2958,9 +2958,9 @@ gfc_add_strides (tree expr, tree desc, int beg, int end)
/* This function calculates the new offset via
new_offset = offset + this_image ()
- * arrray.stride[first_codimension]
+ * array.stride[first_codimension]
+ sum (remaining codimension offsets)
- If offset is a pointer, we also need to multiply it by the size.*/
+ If offset is a pointer, we also need to multiply it by the size. */
static tree
gfc_native_coarray_add_this_image_offset (tree offset, tree desc,
gfc_array_ref *ar, int is_pointer,
@@ -2968,30 +2968,30 @@ gfc_native_coarray_add_this_image_offset (tree offset, tree desc,
{
tree tmp, off;
/* Calculate the actual offset. */
- tmp = build_call_expr_loc (input_location, gfor_fndecl_nca_this_image,
+ tmp = build_call_expr_loc (input_location, gfor_fndecl_cas_this_image,
1, integer_zero_node);
- tmp = convert (TREE_TYPE(gfc_index_zero_node), tmp);
- tmp = fold_build2_loc (input_location, MINUS_EXPR, TREE_TYPE(tmp), tmp,
- build_int_cst (TREE_TYPE(tmp), subtract));
- tmp = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE(tmp),
+ tmp = convert (TREE_TYPE (gfc_index_zero_node), tmp);
+ tmp = fold_build2_loc (input_location, MINUS_EXPR, TREE_TYPE (tmp), tmp,
+ build_int_cst (TREE_TYPE (tmp), subtract));
+ tmp = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (tmp),
gfc_conv_array_stride (desc, ar->dimen), tmp);
/* We also need to add the missing strides once to compensate for the
offset, that is to large now. The loop starts at sym->as.rank+1
- because we need to skip the first corank stride */
+ because we need to skip the first corank stride. */
off = gfc_add_strides (tmp, desc, ar->as->rank + 1,
ar->as->rank + ar->as->corank);
if (is_pointer)
{
- /* Remove pointer and array from type in order to get the raw base type. */
- tmp = TREE_TYPE(TREE_TYPE(TREE_TYPE(offset)));
+ /* Remove pointer and array from type in order to get the raw base type. */
+ tmp = TREE_TYPE (TREE_TYPE (TREE_TYPE (offset)));
/* And get the size of that base type. */
- tmp = convert (TREE_TYPE(off), size_in_bytes_loc (input_location, tmp));
- tmp = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE(off),
+ tmp = convert (TREE_TYPE (off), size_in_bytes_loc (input_location, tmp));
+ tmp = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (off),
off, tmp);
return fold_build_pointer_plus_loc (input_location, offset, tmp);
}
else
- return fold_build2_loc (input_location, PLUS_EXPR, TREE_TYPE(offset),
+ return fold_build2_loc (input_location, PLUS_EXPR, TREE_TYPE (offset),
offset, off);
}
@@ -3040,7 +3040,7 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
/* If we have a native coarray with implied this_image (), add the
appropriate offset to the data pointer. */
ref = ss_info->expr->ref;
- if (flag_coarray == GFC_FCOARRAY_NATIVE && ref
+ if (flag_coarray == GFC_FCOARRAY_SHARED && ref
&& ref->u.ar.dimen_type[ref->u.ar.dimen + ref->u.ar.codimen - 1]
== DIMEN_THIS_IMAGE)
tmp = gfc_native_coarray_add_this_image_offset (tmp, se.expr, &ref->u.ar, 1, 1);
@@ -3060,7 +3060,7 @@ gfc_conv_ss_descriptor (stmtblock_t * block, gfc_ss * ss, int base)
offset for the codimensions. */
// TODO: check whether the recipient is a coarray, if it is, disable
// all of this
- if (flag_coarray == GFC_FCOARRAY_NATIVE && ref
+ if (flag_coarray == GFC_FCOARRAY_SHARED && ref
&& ref->u.ar.dimen_type[ref->u.ar.dimen + ref->u.ar.codimen - 1]
== DIMEN_THIS_IMAGE)
tmp = gfc_add_strides (tmp, se.expr, ref->u.ar.as->rank,
@@ -3665,7 +3665,6 @@ build_array_ref (tree desc, tree offset, tree decl, tree vptr)
}
-
/* Build an array reference. se->expr already holds the array descriptor.
This should be either a variable, indirect variable reference or component
reference. For arrays which do not have a descriptor, se->expr will be
@@ -3685,20 +3684,21 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
gfc_se tmpse;
gfc_symbol * sym = expr->symtree->n.sym;
char *var_name = NULL;
+ /* True if the base needs the implied image offset. */
bool need_impl_this_image;
int eff_dimen;
need_impl_this_image =
ar->dimen_type[ar->dimen + ar->codimen - 1] == DIMEN_THIS_IMAGE;
- if (flag_coarray == GFC_FCOARRAY_NATIVE
+ if (flag_coarray == GFC_FCOARRAY_SHARED
&& !need_impl_this_image)
eff_dimen = ar->dimen + ar->codimen - 1;
else
eff_dimen = ar->dimen - 1;
- if (flag_coarray != GFC_FCOARRAY_NATIVE && ar->dimen == 0)
+ if (flag_coarray != GFC_FCOARRAY_SHARED && ar->dimen == 0)
{
gcc_assert (ar->codimen || sym->attr.select_rank_temporary
|| (ar->as && ar->as->corank));
@@ -3838,7 +3838,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
add_to_offset (&cst_offset, &offset, tmp);
}
- if (flag_coarray == GFC_FCOARRAY_NATIVE && need_impl_this_image)
+ if (flag_coarray == GFC_FCOARRAY_SHARED && need_impl_this_image)
offset = gfc_native_coarray_add_this_image_offset (offset, se->expr, ar, 0, 0);
if (!integer_zerop (cst_offset))
@@ -5584,6 +5584,10 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
for (n = 0; n < rank; n++)
{
+
+ if (flag_coarray != GFC_FCOARRAY_SHARED)
+ conv_lbound = conv_ubound = NULL_TREE;
+
/* We have 3 possibilities for determining the size of the array:
lower == NULL => lbound = 1, ubound = upper[n]
upper[n] = NULL => lbound = 1, ubound = lower[n]
@@ -5734,7 +5738,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
gfc_conv_descriptor_lbound_set (descriptor_block, descriptor,
gfc_rank_cst[n], se.expr);
conv_lbound = se.expr;
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
{
tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
@@ -5751,14 +5755,18 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
gfc_add_block_to_block (pblock, &se.pre);
gfc_conv_descriptor_ubound_set (descriptor_block, descriptor,
gfc_rank_cst[n], se.expr);
- gfc_conv_descriptor_stride_set (descriptor_block, descriptor,
- gfc_rank_cst[n], stride);
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
+ /* It is unclear why we don't need this in for -fcoarray=lib,
+ but since the addition of shared coarrays should not change
+ the semantics, it's inside this if. */
+ gfc_conv_descriptor_stride_set (descriptor_block, descriptor,
+ gfc_rank_cst[n], stride);
conv_ubound = se.expr;
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
{
- size = gfc_conv_array_extent_dim (conv_lbound, conv_ubound,
+ size = gfc_conv_array_extent_dim (conv_lbound, conv_ubound,
&or_expr);
- size = gfc_evaluate_now (size, descriptor_block);
+ size = gfc_evaluate_now (size, descriptor_block);
stride = fold_build2_loc (input_location, MULT_EXPR,
gfc_array_index_type, stride, size);
stride = gfc_evaluate_now (stride, descriptor_block);
@@ -5796,7 +5804,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
/* Convert to size_t. */
*element_size = fold_convert (size_type_node, tmp);
- if (rank == 0 && !(flag_coarray == GFC_FCOARRAY_NATIVE && corank))
+ if (rank == 0 && !(flag_coarray == GFC_FCOARRAY_SHARED && corank))
return *element_size;
*nelems = gfc_evaluate_now (stride, pblock);
@@ -5906,7 +5914,7 @@ gfc_allocate_native_coarray (stmtblock_t *b, tree decl, tree size, int corank,
int alloc_type)
{
gfc_add_expr_to_block (b,
- build_call_expr_loc (input_location, gfor_fndecl_nca_coarray_allocate,
+ build_call_expr_loc (input_location, gfor_fndecl_cas_coarray_allocate,
4, gfc_build_addr_expr (pvoid_type_node, decl),
size, build_int_cst (integer_type_node, corank),
build_int_cst (integer_type_node, alloc_type)));
@@ -6055,7 +6063,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
expr3_elem_size, nelems, expr3, e3_arr_desc,
e3_has_nodescriptor, expr, &element_size);
- if (dimension || (flag_coarray == GFC_FCOARRAY_NATIVE && coarray))
+ if (dimension || (flag_coarray == GFC_FCOARRAY_SHARED && coarray))
{
var_overflow = gfc_create_var (integer_type_node, "overflow");
gfc_add_modify (&se->pre, var_overflow, overflow);
@@ -6097,7 +6105,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 (allocatable && !(flag_coarray == GFC_FCOARRAY_NATIVE && coarray))
+ if (allocatable && !(flag_coarray == GFC_FCOARRAY_SHARED && coarray))
{
not_prev_allocated = gfc_create_var (logical_type_node,
"not_prev_allocated");
@@ -6110,7 +6118,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
gfc_start_block (&elseblock);
- if (coarray && flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (coarray && flag_coarray == GFC_FCOARRAY_SHARED)
{
tree elem_size
= size_in_bytes (gfc_get_element_type (TREE_TYPE(se->expr)));
@@ -6170,9 +6178,9 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
build_empty_stmt (input_location));
}
- // For native coarrays, the size must be set before the allocation routine
- // can be called.
- if (coarray && flag_coarray == GFC_FCOARRAY_NATIVE)
+ /* For native coarrays, the size must be set before the allocation routine
+ can be called. */
+ if (coarray && flag_coarray == GFC_FCOARRAY_SHARED)
{
gfc_add_expr_to_block (&se->pre, set_descriptor);
gfc_add_expr_to_block (&se->pre, allocation);
@@ -6800,7 +6808,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
offset = gfc_index_zero_node;
size = gfc_index_one_node;
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
eff_dimen = as->rank + as->corank;
else
eff_dimen = as->rank;
@@ -7046,12 +7054,12 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset,
return;
}
- /* if it's a coarray with implicit this_image, add that to the offset. */
+ /* If it's a coarray with implicit this_image, add that to the offset. */
ref = expr->ref;
- if (flag_coarray == GFC_FCOARRAY_NATIVE && ref && ref->type == REF_ARRAY
+ if (flag_coarray == GFC_FCOARRAY_SHARED && ref && ref->type == REF_ARRAY
&& ref->u.ar.dimen_type[ref->u.ar.dimen + ref->u.ar.codimen - 1]
== DIMEN_THIS_IMAGE
- && !ref->u.ar.native_coarray_argument)
+ && !ref->u.ar.shared_coarray_arg)
offset = gfc_native_coarray_add_this_image_offset (offset, desc,
&ref->u.ar, 0, 1);
@@ -7061,7 +7069,7 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset,
subreferences; e.g. my_integer => my_type(:)%integer_component. */
if (subref)
{
- /* Go past the array reference. */
+ /* Go past the array reference. */
for (ref = expr->ref; ref; ref = ref->next)
{
if (ref->type == REF_ARRAY &&
@@ -7070,7 +7078,7 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset,
ref = ref->next;
break;
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE && ref->type == REF_ARRAY &&
+ else if (flag_coarray == GFC_FCOARRAY_SHARED && ref->type == REF_ARRAY &&
ref->u.ar.dimen_type[ref->u.ar.dimen +ref->u.ar.codimen -1]
== DIMEN_THIS_IMAGE)
tmp = gfc_native_coarray_add_this_image_offset (tmp, desc, &ref->u.ar, 0, 1);
@@ -7137,8 +7145,8 @@ gfc_get_dataptr_offset (stmtblock_t *block, tree parm, tree desc, tree offset,
gfc_array_index_type, stride, itmp);
stride = gfc_evaluate_now (stride, block);
}
- if (flag_coarray == GFC_FCOARRAY_NATIVE &&
- ref->u.ar.dimen_type[ref->u.ar.dimen +ref->u.ar.codimen -1]
+ if (flag_coarray == GFC_FCOARRAY_SHARED &&
+ ref->u.ar.dimen_type[ref->u.ar.dimen + ref->u.ar.codimen -1]
== DIMEN_THIS_IMAGE)
tmp = gfc_native_coarray_add_this_image_offset (tmp, desc, &ref->u.ar, 0, 1);
/* Apply the index to obtain the array element. */
@@ -7491,7 +7499,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
else
full = gfc_full_array_ref_p (info->ref, NULL);
- if (flag_coarray == GFC_FCOARRAY_NATIVE &&
+ if (flag_coarray == GFC_FCOARRAY_SHARED &&
info->ref->type == REF_ARRAY &&
info->ref->u.ar.dimen_type[info->ref->u.ar.dimen
+ info->ref->u.ar.codimen - 1] ==
@@ -7732,19 +7740,17 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
tree to;
tree base;
tree offset;
-#if 0 /* TK */
- ndim = info->ref ? info->ref->u.ar.dimen : ss->dimen;
-#else
+
if (info->ref)
{
- if (info->ref->u.ar.native_coarray_argument)
+ if (info->ref->u.ar.shared_coarray_arg)
ndim = info->ref->u.ar.dimen + info->ref->u.ar.codimen;
else
ndim = info->ref->u.ar.dimen;
}
else
ndim = ss->dimen;
-#endif
+
if (se->want_coarray)
{
gfc_array_ref *ar = &info->ref->u.ar;
@@ -8113,15 +8119,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
expr->ts.u.cl->backend_decl = tmp;
se->string_length = tmp;
}
-#if 0
- if (flag_coarray == GFC_FCOARRAY_NATIVE && fsym && fsym->attr.codimension && sym)
- {
- gfc_init_se (se, NULL);
- tmp = gfc_get_symbol_decl (sym);
- se->expr = gfc_build_addr_expr (NULL_TREE, tmp);
- return;
- }
-#endif
+
/* Is this the result of the enclosing procedure? */
this_array_result = (full_array_var && sym->attr.flavor == FL_PROCEDURE);
if (this_array_result
@@ -8129,10 +8127,9 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
&& (sym->backend_decl != parent))
this_array_result = false;
-#if 1 /* TK */
- if (flag_coarray == GFC_FCOARRAY_NATIVE && fsym && fsym->attr.codimension)
+ if (flag_coarray == GFC_FCOARRAY_SHARED && fsym && fsym->attr.codimension)
g77 = false;
-#endif
+
/* Passing address of the array if it is not pointer or assumed-shape. */
if (full_array_var && g77 && !this_array_result
&& sym->ts.type != BT_DERIVED && sym->ts.type != BT_CLASS)
@@ -11083,13 +11080,13 @@ gfc_walk_array_ref (gfc_ss * ss, gfc_expr * expr, gfc_ref * ref)
case AR_SECTION:
newss = gfc_get_array_ss (ss, expr, 0, GFC_SS_SECTION);
newss->info->data.array.ref = ref;
-#if 1 /* TK */
+
int eff_dimen;
- if (ar->native_coarray_argument)
+ if (ar->shared_coarray_arg)
eff_dimen = ar->dimen + ar->codimen;
else
eff_dimen = ar->dimen;
-#endif
+
/* We add SS chains for all the subscripts in the section. */
for (n = 0; n < eff_dimen; n++)
{
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 0bfd1b0..d0b05aa 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -24,10 +24,11 @@ bool gfc_array_allocate (gfc_se *, gfc_expr *, tree, tree, tree, tree,
tree, tree *, gfc_expr *, tree, bool);
enum gfc_coarray_allocation_type {
- GFC_NCA_NORMAL_COARRAY = 3,
+ GFC_NCA_NORMAL_COARRAY = 1,
GFC_NCA_LOCK_COARRAY,
GFC_NCA_EVENT_COARRAY
};
+
int gfc_native_coarray_get_allocation_type (gfc_symbol *);
void gfc_allocate_native_coarray (stmtblock_t *, tree, tree, int, int);
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 5eadf40..3b5bf0c 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -172,19 +172,19 @@ tree gfor_fndecl_caf_is_present;
/* Native coarray functions. */
-tree gfor_fndecl_nca_master;
-tree gfor_fndecl_nca_coarray_allocate;
-tree gfor_fndecl_nca_coarray_free;
-tree gfor_fndecl_nca_this_image;
-tree gfor_fndecl_nca_num_images;
-tree gfor_fndecl_nca_sync_all;
-tree gfor_fndecl_nca_sync_images;
-tree gfor_fndecl_nca_lock;
-tree gfor_fndecl_nca_unlock;
-tree gfor_fndecl_nca_reduce_scalar;
-tree gfor_fndecl_nca_reduce_array;
-tree gfor_fndecl_nca_broadcast_scalar;
-tree gfor_fndecl_nca_broadcast_array;
+tree gfor_fndecl_cas_master;
+tree gfor_fndecl_cas_coarray_allocate;
+tree gfor_fndecl_cas_coarray_free;
+tree gfor_fndecl_cas_this_image;
+tree gfor_fndecl_cas_num_images;
+tree gfor_fndecl_cas_sync_all;
+tree gfor_fndecl_cas_sync_images;
+tree gfor_fndecl_cas_lock;
+tree gfor_fndecl_cas_unlock;
+tree gfor_fndecl_cas_reduce_scalar;
+tree gfor_fndecl_cas_reduce_array;
+tree gfor_fndecl_cas_broadcast_scalar;
+tree gfor_fndecl_cas_broadcast_array;
/* Math functions. Many other math functions are handled in
trans-intrinsic.c. */
@@ -1048,7 +1048,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
gfc_add_decl_to_function (token);
}
- eff_dimen = flag_coarray == GFC_FCOARRAY_NATIVE
+ eff_dimen = flag_coarray == GFC_FCOARRAY_SHARED
? GFC_TYPE_ARRAY_RANK (type) + GFC_TYPE_ARRAY_CORANK (type)
: GFC_TYPE_ARRAY_RANK (type);
@@ -1075,7 +1075,11 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
}
}
- if (flag_coarray != GFC_FCOARRAY_NATIVE)
+ /* We don't need the following code in shared coarray mode, since the
+ dimensions are handled the usual way in the loop above
+ (eff_dimen = dimen + codimen). */
+
+ if (flag_coarray != GFC_FCOARRAY_SHARED)
for (dim = GFC_TYPE_ARRAY_RANK (type);
dim < GFC_TYPE_ARRAY_RANK (type) + GFC_TYPE_ARRAY_CORANK (type);
dim++)
@@ -1230,7 +1234,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
|| (as && as->type == AS_ASSUMED_RANK))
return dummy;
- if (flag_coarray == GFC_FCOARRAY_NATIVE && sym->attr.codimension
+ if (flag_coarray == GFC_FCOARRAY_SHARED && sym->attr.codimension
&& sym->attr.allocatable)
return dummy;
@@ -1851,7 +1855,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
}
/* Remember this variable for allocation/cleanup. */
- if (sym->attr.dimension || sym->attr.codimension || sym->attr.allocatable
+ if (sym->attr.dimension || sym->attr.allocatable || sym->attr.codimension
|| (sym->ts.type == BT_CLASS &&
(CLASS_DATA (sym)->attr.dimension
|| CLASS_DATA (sym)->attr.allocatable))
@@ -1900,7 +1904,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
gcc_assert (!sym->value || sym->value->expr_type == EXPR_NULL);
}
- if (flag_coarray == GFC_FCOARRAY_NATIVE && sym->attr.codimension)
+ if (flag_coarray == GFC_FCOARRAY_SHARED && sym->attr.codimension)
TREE_STATIC(decl) = 1;
gfc_finish_var_decl (decl, sym);
@@ -4096,65 +4100,65 @@ gfc_build_builtin_function_decls (void)
integer_type_node, 3, pvoid_type_node, integer_type_node,
pvoid_type_node);
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_SHARED)
{
- gfor_fndecl_nca_master = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_master")), ".r", integer_type_node, 1,
+ gfor_fndecl_cas_master = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_master")), ".r", integer_type_node, 1,
build_pointer_type (build_function_type_list (void_type_node, NULL_TREE)));
- gfor_fndecl_nca_coarray_allocate = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_coarray_alloc")), "..RRR", integer_type_node, 4,
+ gfor_fndecl_cas_coarray_allocate = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_coarray_alloc")), "..RRR", integer_type_node, 4,
pvoid_type_node, integer_type_node, integer_type_node, integer_type_node,
NULL_TREE);
- gfor_fndecl_nca_coarray_free = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_coarray_free")), "..R", integer_type_node, 2,
+ gfor_fndecl_cas_coarray_free = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_coarray_free")), "..R", integer_type_node, 2,
pvoid_type_node, /* Pointer to the descriptor to be deallocated. */
integer_type_node, /* Type of allocation (normal, event, lock). */
NULL_TREE);
- gfor_fndecl_nca_this_image = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_coarray_this_image")), ".X", integer_type_node, 1,
+ gfor_fndecl_cas_this_image = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_coarray_this_image")), ".X", integer_type_node, 1,
integer_type_node, /* This is the team number. Currently ignored. */
NULL_TREE);
- DECL_PURE_P (gfor_fndecl_nca_this_image) = 1;
- gfor_fndecl_nca_num_images = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_coarray_num_images")), ".X", integer_type_node, 1,
+ DECL_PURE_P (gfor_fndecl_cas_this_image) = 1;
+ gfor_fndecl_cas_num_images = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_coarray_num_images")), ".X", integer_type_node, 1,
integer_type_node, /* See above. */
NULL_TREE);
- DECL_PURE_P (gfor_fndecl_nca_num_images) = 1;
- gfor_fndecl_nca_sync_all = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_coarray_sync_all")), ".X", void_type_node, 1,
+ DECL_PURE_P (gfor_fndecl_cas_num_images) = 1;
+ gfor_fndecl_cas_sync_all = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_coarray_sync_all")), ".X", void_type_node, 1,
build_pointer_type (integer_type_node), NULL_TREE);
- gfor_fndecl_nca_sync_images = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_sync_images")), ".RRXXX", void_type_node,
+ gfor_fndecl_cas_sync_images = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_sync_images")), ".RRXXX", void_type_node,
5, integer_type_node, pint_type, pint_type,
pchar_type_node, size_type_node, NULL_TREE);
- gfor_fndecl_nca_lock = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_lock")), ".w", void_type_node, 1,
+ gfor_fndecl_cas_lock = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_lock")), ".w", void_type_node, 1,
pvoid_type_node, NULL_TREE);
- gfor_fndecl_nca_unlock = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_unlock")), ".w", void_type_node, 1,
+ gfor_fndecl_cas_unlock = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("cas_unlock")), ".w", void_type_node, 1,
pvoid_type_node, NULL_TREE);
- gfor_fndecl_nca_reduce_scalar =
+ gfor_fndecl_cas_reduce_scalar =
gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_collsub_reduce_scalar")), ".wrW",
+ get_identifier (PREFIX("cas_collsub_reduce_scalar")), ".wrW",
void_type_node, 3, pvoid_type_node,
build_pointer_type (build_function_type_list (void_type_node,
pvoid_type_node, pvoid_type_node, NULL_TREE)),
pint_type, NULL_TREE);
- gfor_fndecl_nca_reduce_array =
+ gfor_fndecl_cas_reduce_array =
gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("nca_collsub_reduce_array")), ".wrWR",
+ get_identifier (PREFIX("cas_collsub_reduce_array")), ".wrWR",
void_type_node, 4, pvoid_type_node,
build_pointer_type (build_function_type_list (void_type_node,
pvoid_type_node, pvoid_type_node, NULL_TREE)),
pint_type, integer_type_node, NULL_TREE);
- gfor_fndecl_nca_broadcast_scalar = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX ("nca_collsub_broadcast_scalar")), ".w..",
+ gfor_fndecl_cas_broadcast_scalar = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX ("cas_collsub_broadcast_scalar")), ".w..",
void_type_node, 3, pvoid_type_node, size_type_node, integer_type_node);
- gfor_fndecl_nca_broadcast_array = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX ("nca_collsub_broadcast_array")), ".W.",
+ gfor_fndecl_cas_broadcast_array = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX ("cas_collsub_broadcast_array")), ".W.",
void_type_node, 2, pvoid_type_node, integer_type_node);
}
@@ -4638,7 +4642,8 @@ void
gfc_trans_native_coarray (stmtblock_t * init, stmtblock_t *cleanup, gfc_symbol * sym)
{
tree tmp, decl;
- tree overflow = build_int_cst (integer_type_node, 0), nelems, element_size; //All unused
+ /* All unused, but needed as arguments. */
+ tree overflow = build_int_cst (integer_type_node, 0), nelems, element_size;
tree offset;
tree elem_size;
int alloc_type;
@@ -4665,7 +4670,7 @@ gfc_trans_native_coarray (stmtblock_t * init, stmtblock_t *cleanup, gfc_symbol *
if (cleanup)
{
- tmp = build_call_expr_loc (input_location, gfor_fndecl_nca_coarray_free,
+ tmp = build_call_expr_loc (input_location, gfor_fndecl_cas_coarray_free,
2, gfc_build_addr_expr (pvoid_type_node, decl),
build_int_cst (integer_type_node, alloc_type));
gfc_add_expr_to_block (cleanup, tmp);
@@ -4997,7 +5002,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
gfc_trans_deferred_array (sym, block);
}
}
- else if (flag_coarray != GFC_FCOARRAY_NATIVE
+ else if (flag_coarray != GFC_FCOARRAY_SHARED
&& sym->attr.codimension
&& TREE_STATIC (sym->backend_decl))
{
@@ -5008,7 +5013,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
NULL_TREE);
continue;
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE
+ else if (flag_coarray == GFC_FCOARRAY_SHARED
&& sym->attr.codimension)
{
gfc_trans_native_coarray_inline (block, sym);
@@ -5504,7 +5509,7 @@ gfc_create_module_variable (gfc_symbol * sym)
DECL_CONTEXT (decl) = sym->ns->proc_name->backend_decl;
rest_of_decl_compilation (decl, 1, 0);
- if (flag_coarray == GFC_FCOARRAY_NATIVE && sym->attr.codimension
+ if (flag_coarray == GFC_FCOARRAY_SHARED && sym->attr.codimension
&& !sym->attr.allocatable)
gfc_trans_native_coarray_static (sym);
@@ -5916,7 +5921,7 @@ generate_coarray_constructor_function (tree *save_fn_decl, tree *fndecl)
tmp = build_function_type_list (void_type_node, NULL_TREE);
*fndecl = build_decl (input_location, FUNCTION_DECL,
- create_tmp_var_name (flag_coarray == GFC_FCOARRAY_LIB ? "_caf_init" : "_nca_init"), tmp);
+ create_tmp_var_name (flag_coarray == GFC_FCOARRAY_LIB ? "_caf_init" : "_cas_init"), tmp);
DECL_STATIC_CONSTRUCTOR (*fndecl) = 1;
SET_DECL_INIT_PRIORITY (*fndecl, DEFAULT_INIT_PRIORITY);
@@ -6663,8 +6668,8 @@ create_main_function (tree fndecl)
}
/* Call MAIN__(). */
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
- tmp = build_call_expr_loc (input_location, gfor_fndecl_nca_master, 1,
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
+ tmp = build_call_expr_loc (input_location, gfor_fndecl_cas_master, 1,
gfc_build_addr_expr (NULL, fndecl));
else
tmp = build_call_expr_loc (input_location,
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 9979980..e6385be2 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2623,13 +2623,8 @@ gfc_maybe_dereference_var (gfc_symbol *sym, tree var, bool descriptor_only_p,
else if (!sym->attr.value)
{
- /* Do not derefernce native coarray dummies. */
- if (false && flag_coarray == GFC_FCOARRAY_NATIVE
- && sym->attr.codimension && sym->attr.dummy)
- return var;
-
/* Dereference temporaries for class array dummy arguments. */
- else if (sym->attr.dummy && is_classarray
+ if (sym->attr.dummy && is_classarray
&& GFC_ARRAY_TYPE_P (TREE_TYPE (var)))
{
if (!descriptor_only_p)
@@ -2641,7 +2636,7 @@ gfc_maybe_dereference_var (gfc_symbol *sym, tree var, bool descriptor_only_p,
/* Dereference non-character scalar dummy arguments. */
if (sym->attr.dummy && !sym->attr.dimension
&& !(sym->attr.codimension && sym->attr.allocatable)
- && !(sym->attr.codimension && flag_coarray == GFC_FCOARRAY_NATIVE)
+ && !(sym->attr.codimension && flag_coarray == GFC_FCOARRAY_SHARED)
&& (sym->ts.type != BT_CLASS
|| (!CLASS_DATA (sym)->attr.dimension
&& !(CLASS_DATA (sym)->attr.codimension
@@ -5536,10 +5531,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
nodesc_arg = nodesc_arg || !comp->attr.always_explicit;
else
nodesc_arg = nodesc_arg || !sym->attr.always_explicit;
-#if 0
- if (flag_coarray == GFC_FCOARRAY_NATIVE && fsym->attr.codimension)
- nodesc_arg = false;
-#endif
+
/* Class array expressions are sometimes coming completely unadorned
with either arrayspec or _data component. Correct that here.
OOP-TODO: Move this to the frontend. */
@@ -5731,10 +5723,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
parmse.want_coarray = 1;
scalar = false;
}
-#if 0
- if (flag_coarray == GFC_FCOARRAY_NATIVE && fsym->attr.codimension)
- scalar = false;
-#endif
+
/* A scalar or transformational function. */
if (scalar)
{
@@ -6247,7 +6236,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else
gfc_conv_array_parameter (&parmse, e, nodesc_arg, fsym,
sym->name, NULL);
-
+
/* Unallocated allocatable arrays and unassociated pointer arrays
need their dtype setting if they are argument associated with
assumed rank dummies. */
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index b418321..2f58ce7 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -2395,8 +2395,8 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
else
tmp = integer_zero_node;
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE ?
- gfor_fndecl_nca_this_image :
+ flag_coarray == GFC_FCOARRAY_SHARED ?
+ gfor_fndecl_cas_this_image :
gfor_fndecl_caf_this_image,
1, tmp);
se->expr = fold_convert (gfc_get_int_type (gfc_default_integer_kind),
@@ -2405,7 +2405,6 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
}
/* Coarray-argument version: THIS_IMAGE(coarray [, dim]). */
- /* TODO: NCA handle native coarrays. */
type = gfc_get_int_type (gfc_default_integer_kind);
corank = gfc_get_corank (expr->value.function.actual->expr);
@@ -2495,8 +2494,8 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
/* this_image () - 1. */
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE
- ? gfor_fndecl_nca_this_image
+ flag_coarray == GFC_FCOARRAY_SHARED
+ ? gfor_fndecl_cas_this_image
: gfor_fndecl_caf_this_image,
1, integer_zero_node);
tmp = fold_build2_loc (input_location, MINUS_EXPR, type,
@@ -2782,8 +2781,8 @@ trans_image_index (gfc_se * se, gfc_expr *expr)
else
{
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE
- ? gfor_fndecl_nca_num_images
+ flag_coarray == GFC_FCOARRAY_SHARED
+ ? gfor_fndecl_cas_num_images
: gfor_fndecl_caf_num_images, 2,
integer_zero_node,
build_int_cst (integer_type_node, -1));
@@ -2830,8 +2829,8 @@ trans_num_images (gfc_se * se, gfc_expr *expr)
else
failed = build_int_cst (integer_type_node, -1);
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
- tmp = build_call_expr_loc (input_location, gfor_fndecl_nca_num_images, 1,
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
+ tmp = build_call_expr_loc (input_location, gfor_fndecl_cas_num_images, 1,
distance);
else
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_num_images, 2,
@@ -3280,8 +3279,8 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr)
cosize = gfc_conv_descriptor_cosize (desc, arg->expr->rank, corank);
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE
- ? gfor_fndecl_nca_num_images
+ flag_coarray == GFC_FCOARRAY_SHARED
+ ? gfor_fndecl_cas_num_images
: gfor_fndecl_caf_num_images,
2, integer_zero_node,
build_int_cst (integer_type_node, -1));
@@ -3299,8 +3298,9 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr)
{
/* ubound = lbound + num_images() - 1. */
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE ? gfor_fndecl_nca_num_images :
- gfor_fndecl_caf_num_images,
+ flag_coarray == GFC_FCOARRAY_SHARED
+ ? gfor_fndecl_cas_num_images
+ : gfor_fndecl_caf_num_images,
2, integer_zero_node,
build_int_cst (integer_type_node, -1));
tmp = fold_build2_loc (input_location, MINUS_EXPR,
@@ -11024,7 +11024,8 @@ gfc_walk_intrinsic_function (gfc_ss * ss, gfc_expr * expr,
}
}
-/* Helper function - advance to the next argument. */
+/* Helper function - translate an argument and advance to the next.
+ Coarrays are irrelevant here, since we just translate normal arguments. */
static tree
trans_argument (gfc_actual_arglist **curr_al, stmtblock_t *blk,
@@ -11045,7 +11046,7 @@ trans_argument (gfc_actual_arglist **curr_al, stmtblock_t *blk,
/* Convert CO_REDUCE for native coarrays. */
static tree
-conv_nca_reduce (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
+conv_cas_reduce (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
{
gfc_actual_arglist *curr_al;
tree var, reduce_op, result_image, elem_size;
@@ -11054,6 +11055,8 @@ conv_nca_reduce (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
curr_al = code->ext.actual;
+ /* We cannot move the gfc_init_se treatment into trans_argument, because we
+ cannot be sure that we want a pointer. */
gfc_init_se (&argse, NULL);
argse.want_pointer = 1;
is_array = curr_al->expr->rank > 0;
@@ -11069,16 +11072,16 @@ conv_nca_reduce (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
null_pointer_node);
if (is_array)
- return build_call_expr_loc (input_location, gfor_fndecl_nca_reduce_array,
+ return build_call_expr_loc (input_location, gfor_fndecl_cas_reduce_array,
3, var, reduce_op, result_image);
elem_size = size_in_bytes(TREE_TYPE(TREE_TYPE(var)));
- return build_call_expr_loc (input_location, gfor_fndecl_nca_reduce_scalar, 4,
+ return build_call_expr_loc (input_location, gfor_fndecl_cas_reduce_scalar, 4,
var, elem_size, reduce_op, result_image);
}
static tree
-conv_nca_broadcast (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
+conv_cas_broadcast (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
{
gfc_actual_arglist *curr_al;
tree var, source_image, elem_size;
@@ -11097,11 +11100,11 @@ conv_nca_broadcast (gfc_code *code, stmtblock_t *blk, stmtblock_t *postblk)
source_image = trans_argument (&curr_al, blk, postblk, &argse, NULL_TREE);
if (is_array)
- return build_call_expr_loc (input_location, gfor_fndecl_nca_broadcast_array,
+ return build_call_expr_loc (input_location, gfor_fndecl_cas_broadcast_array,
2, var, source_image);
elem_size = size_in_bytes(TREE_TYPE(TREE_TYPE(var)));
- return build_call_expr_loc (input_location, gfor_fndecl_nca_broadcast_scalar,
+ return build_call_expr_loc (input_location, gfor_fndecl_cas_broadcast_scalar,
3, var, elem_size, source_image);
}
@@ -11110,7 +11113,7 @@ static tree conv_co_collective (gfc_code *);
/* Convert collective subroutines for native coarrays. */
static tree
-conv_nca_collective (gfc_code *code)
+conv_cas_collective (gfc_code *code)
{
switch (code->resolved_isym->id)
@@ -11122,11 +11125,12 @@ conv_nca_collective (gfc_code *code)
gfc_start_block (&block);
gfc_init_block (&postblock);
- fcall = conv_nca_reduce (code, &block, &postblock);
+ fcall = conv_cas_reduce (code, &block, &postblock);
gfc_add_expr_to_block (&block, fcall);
gfc_add_block_to_block (&block, &postblock);
return gfc_finish_block (&block);
}
+
case GFC_ISYM_CO_SUM:
case GFC_ISYM_CO_MIN:
case GFC_ISYM_CO_MAX:
@@ -11139,15 +11143,12 @@ conv_nca_collective (gfc_code *code)
gfc_start_block (&block);
gfc_init_block (&postblock);
- fcall = conv_nca_broadcast (code, &block, &postblock);
+ fcall = conv_cas_broadcast (code, &block, &postblock);
gfc_add_expr_to_block (&block, fcall);
gfc_add_block_to_block (&block, &postblock);
return gfc_finish_block (&block);
}
-#if 0
- case GFC_ISYM_CO_BROADCAST:
- return conv_co_collective (code);
-#endif
+
default:
gfc_internal_error ("Invalid or unsupported isym");
break;
@@ -11264,7 +11265,7 @@ conv_co_collective (gfc_code *code)
/* For native coarrays, we only come here for CO_BROADCAST. */
gcc_assert (code->resolved_isym->id == GFC_ISYM_CO_BROADCAST
- || flag_coarray != GFC_FCOARRAY_NATIVE);
+ || flag_coarray != GFC_FCOARRAY_SHARED);
/* Generate the function call. */
@@ -12260,8 +12261,8 @@ gfc_conv_intrinsic_subroutine (gfc_code *code)
case GFC_ISYM_CO_MAX:
case GFC_ISYM_CO_REDUCE:
case GFC_ISYM_CO_SUM:
- if (flag_coarray == GFC_FCOARRAY_NATIVE)
- res = conv_nca_collective (code);
+ if (flag_coarray == GFC_FCOARRAY_SHARED)
+ res = conv_cas_collective (code);
else
res = conv_co_collective (code);
break;
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 4897fa1..67cba1d 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -832,7 +832,7 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op)
return early. (ERRMSG= is always untouched for -fcoarray=single.) */
if (!code->expr2 && !code->expr4
&& !(flag_coarray == GFC_FCOARRAY_LIB
- || flag_coarray == GFC_FCOARRAY_NATIVE))
+ || flag_coarray == GFC_FCOARRAY_SHARED))
return NULL_TREE;
if (code->expr2)
@@ -992,7 +992,7 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op)
return gfc_finish_block (&se.pre);
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_SHARED)
{
gfc_se arg;
stmtblock_t res;
@@ -1004,8 +1004,8 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op)
gfc_conv_expr (&arg, code->expr1);
gfc_add_block_to_block (&res, &arg.pre);
call = build_call_expr_loc (input_location, op == EXEC_LOCK ?
- gfor_fndecl_nca_lock
- : gfor_fndecl_nca_unlock,
+ gfor_fndecl_cas_lock
+ : gfor_fndecl_cas_unlock,
1, fold_convert (pvoid_type_node,
gfc_build_addr_expr (NULL, arg.expr)));
gfc_add_expr_to_block (&res, call);
@@ -1209,7 +1209,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
return early. (ERRMSG= is always untouched for -fcoarray=single.) */
if (!code->expr2 && !(gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
&& flag_coarray != GFC_FCOARRAY_LIB
- && flag_coarray != GFC_FCOARRAY_NATIVE)
+ && flag_coarray != GFC_FCOARRAY_SHARED)
return NULL_TREE;
gfc_init_se (&se, NULL);
@@ -1232,7 +1232,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
else
stat = null_pointer_node;
- if (code->expr3 && (flag_coarray == GFC_FCOARRAY_LIB || flag_coarray == GFC_FCOARRAY_NATIVE))
+ if (code->expr3 && (flag_coarray == GFC_FCOARRAY_LIB || flag_coarray == GFC_FCOARRAY_SHARED))
{
gcc_assert (code->expr3->expr_type == EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
@@ -1242,7 +1242,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
errmsg = gfc_build_addr_expr (NULL, argse.expr);
errmsglen = fold_convert (size_type_node, argse.string_length);
}
- else if (flag_coarray == GFC_FCOARRAY_LIB || flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_LIB || flag_coarray == GFC_FCOARRAY_SHARED)
{
errmsg = null_pointer_node;
errmsglen = build_int_cst (size_type_node, 0);
@@ -1255,7 +1255,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
{
tree images2 = fold_convert (integer_type_node, images);
tree cond;
- if (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_SHARED)
cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
images, build_int_cst (TREE_TYPE (images), 1));
else
@@ -1279,13 +1279,13 @@ 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 (flag_coarray == GFC_FCOARRAY_LIB || flag_coarray == GFC_FCOARRAY_NATIVE)
+ if (flag_coarray == GFC_FCOARRAY_LIB || flag_coarray == GFC_FCOARRAY_SHARED)
{
tmp = gfc_trans_memory_barrier ();
gfc_add_expr_to_block (&se.pre, tmp);
}
- if (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_SHARED)
{
/* Set STAT to zero. */
if (code->expr2)
@@ -1312,7 +1312,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_sync_all,
3, stat, errmsg, errmsglen);
else
- tmp = build_call_expr_loc (input_location, gfor_fndecl_nca_sync_all,
+ tmp = build_call_expr_loc (input_location, gfor_fndecl_cas_sync_all,
1, stat);
}
@@ -1380,8 +1380,8 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
stat = gfc_build_addr_expr (NULL, stat);
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE
- ? gfor_fndecl_nca_sync_images
+ flag_coarray == GFC_FCOARRAY_SHARED
+ ? gfor_fndecl_cas_sync_images
: gfor_fndecl_caf_sync_images,
5, fold_convert (integer_type_node, len),
images, stat, errmsg, errmsglen);
@@ -1392,8 +1392,8 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
tree tmp_stat = gfc_create_var (integer_type_node, "stat");
tmp = build_call_expr_loc (input_location,
- flag_coarray == GFC_FCOARRAY_NATIVE
- ? gfor_fndecl_nca_sync_images
+ flag_coarray == GFC_FCOARRAY_SHARED
+ ? gfor_fndecl_cas_sync_images
: gfor_fndecl_caf_sync_images,
5, fold_convert (integer_type_node, len),
images, gfc_build_addr_expr (NULL, tmp_stat),
@@ -1630,7 +1630,7 @@ gfc_trans_critical (gfc_code *code)
gfc_add_expr_to_block (&block, tmp);
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_SHARED)
{
tmp = gfc_trans_lock_unlock (code, EXEC_LOCK);
gfc_add_expr_to_block (&block, tmp);
@@ -1659,7 +1659,7 @@ gfc_trans_critical (gfc_code *code)
gfc_add_expr_to_block (&block, tmp);
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_SHARED)
{
tmp = gfc_trans_lock_unlock (code, EXEC_UNLOCK);
gfc_add_expr_to_block (&block, tmp);
@@ -7213,7 +7213,7 @@ gfc_trans_deallocate (gfc_code *code)
tree apstat, pstat, stat, errmsg, errlen, tmp;
tree label_finish, label_errmsg;
stmtblock_t block;
- bool is_native_coarray = false;
+ bool is_shared_coarray = false;
pstat = apstat = stat = errmsg = errlen = tmp = NULL_TREE;
label_finish = label_errmsg = NULL_TREE;
@@ -7299,7 +7299,7 @@ gfc_trans_deallocate (gfc_code *code)
? GFC_STRUCTURE_CAF_MODE_DEALLOC_ONLY : 0);
}
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_SHARED)
{
gfc_ref *ref, *last;
@@ -7310,16 +7310,16 @@ gfc_trans_deallocate (gfc_code *code)
gfc_symbol *sym = expr->symtree->n.sym;
int alloc_type = gfc_native_coarray_get_allocation_type (sym);
tmp = build_call_expr_loc (input_location,
- gfor_fndecl_nca_coarray_free,
+ gfor_fndecl_cas_coarray_free,
2, gfc_build_addr_expr (pvoid_type_node, se.expr),
build_int_cst (integer_type_node,
alloc_type));
gfc_add_expr_to_block (&block, tmp);
- is_native_coarray = true;
+ is_shared_coarray = true;
}
}
- if ((expr->rank || is_coarray_array) && !is_native_coarray)
+ if ((expr->rank || is_coarray_array) && !is_shared_coarray)
{
gfc_ref *ref;
@@ -7408,7 +7408,7 @@ gfc_trans_deallocate (gfc_code *code)
gfc_reset_len (&se.pre, al->expr);
}
}
- else if (!is_native_coarray)
+ else if (!is_shared_coarray)
{
tmp = gfc_deallocate_scalar_with_status (se.expr, pstat, label_finish,
false, al->expr,
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index f100d34..e586633 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1346,7 +1346,7 @@ gfc_is_nodesc_array (gfc_symbol * sym)
gcc_assert (array_attr->dimension || array_attr->codimension);
/* We need a descriptor for native coarrays. */
- if (flag_coarray == GFC_FCOARRAY_NATIVE && sym->as && sym->as->corank)
+ if (flag_coarray == GFC_FCOARRAY_SHARED && sym->as && sym->as->corank)
return 0;
/* We only want local arrays. */
@@ -1387,7 +1387,7 @@ gfc_build_array_type (tree type, gfc_array_spec * as,
/* For -fcoarray=lib, assumed-shape arrays do not have codimension
information stored in the descriptor. */
- if (flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (flag_coarray != GFC_FCOARRAY_SHARED)
{
corank = MAX (as->corank, codim);
@@ -1608,7 +1608,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
/* We don't use build_array_type because this does not include
lang-specific information (i.e. the bounds of the array) when checking
for duplicates. */
- if (as->rank || (flag_coarray == GFC_FCOARRAY_NATIVE && as->corank))
+ if (as->rank || (flag_coarray == GFC_FCOARRAY_SHARED && as->corank))
type = make_node (ARRAY_TYPE);
else
type = build_variant_type_copy (etype);
@@ -1696,7 +1696,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
GFC_TYPE_ARRAY_UBOUND (type, n) = tmp;
}
- if (flag_coarray == GFC_FCOARRAY_NATIVE && as->rank == 0 && as->corank != 0)
+ if (flag_coarray == GFC_FCOARRAY_SHARED && as->rank == 0 && as->corank != 0)
GFC_TYPE_ARRAY_OFFSET (type) = NULL_TREE;
else if (known_offset)
GFC_TYPE_ARRAY_OFFSET (type) =
@@ -1725,7 +1725,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
build_qualified_type (GFC_TYPE_ARRAY_DATAPTR_TYPE (type),
TYPE_QUAL_RESTRICT);
- if (as->rank == 0 && (flag_coarray != GFC_FCOARRAY_NATIVE || as->corank == 0))
+ if (as->rank == 0 && (flag_coarray != GFC_FCOARRAY_SHARED || as->corank == 0))
{
if (packed != PACKED_STATIC || flag_coarray == GFC_FCOARRAY_LIB)
{
@@ -1993,7 +1993,7 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
/* TODO: known offsets for descriptors. */
GFC_TYPE_ARRAY_OFFSET (fat_type) = NULL_TREE;
- if (flag_coarray != GFC_FCOARRAY_NATIVE && dimen == 0)
+ if (flag_coarray != GFC_FCOARRAY_SHARED && dimen == 0)
{
arraytype = build_pointer_type (etype);
if (restricted)
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 7d9cd32..6815b17 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -49,16 +49,15 @@ const char gfc_msg_fault[] = N_("Array reference out of bounds");
const char gfc_msg_wrong_return[] = N_("Incorrect function return value");
/* Insert a memory barrier into the code. */
-
tree
gfc_trans_memory_barrier (void)
{
tree tmp;
- tmp = gfc_build_string_const (strlen ("memory")+1, "memory"),
- tmp = build5_loc (input_location, ASM_EXPR, void_type_node,
- gfc_build_string_const (1, ""), NULL_TREE, NULL_TREE,
- tree_cons (NULL_TREE, tmp, NULL_TREE), NULL_TREE);
+ tmp = gfc_build_string_const (sizeof ("memory"), "memory");
+ tmp = build5_loc (input_location, ASM_EXPR, void_type_node,
+ gfc_build_string_const (1, ""), NULL_TREE, NULL_TREE,
+ tree_cons (NULL_TREE, tmp, NULL_TREE), NULL_TREE);
ASM_VOLATILE_P (tmp) = 1;
return tmp;
@@ -420,7 +419,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr)
tree span = NULL_TREE;
if (GFC_ARRAY_TYPE_P (type) && GFC_TYPE_ARRAY_RANK (type) == 0
- && flag_coarray != GFC_FCOARRAY_NATIVE)
+ && flag_coarray != GFC_FCOARRAY_SHARED)
{
gcc_assert (GFC_TYPE_ARRAY_CORANK (type) > 0);
@@ -428,7 +427,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr)
}
/* Scalar library coarray, there is nothing to do. */
- if (TREE_CODE (type) != ARRAY_TYPE && flag_coarray != GFC_FCOARRAY_NATIVE)
+ if (TREE_CODE (type) != ARRAY_TYPE && flag_coarray != GFC_FCOARRAY_SHARED)
{
gcc_assert (decl == NULL_TREE);
gcc_assert (integer_zerop (offset));
@@ -1376,7 +1375,7 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
{
gcc_assert (GFC_ARRAY_TYPE_P (caf_type)
&& GFC_TYPE_ARRAY_CAF_TOKEN (caf_type)
- != NULL_TREE);
+ != NULL_TREE);
token = GFC_TYPE_ARRAY_CAF_TOKEN (caf_type);
}
}
@@ -1392,7 +1391,7 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
else
caf_dereg_type = (enum gfc_coarray_deregtype) coarray_dealloc_mode;
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE)
+ else if (flag_coarray == GFC_FCOARRAY_SHARED)
{
orig_desc = pointer;
pointer = gfc_conv_descriptor_data_get (pointer);
@@ -1448,7 +1447,7 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
gfc_add_expr_to_block (&non_null, add_when_allocated);
gfc_add_finalizer_call (&non_null, expr);
if (coarray_dealloc_mode == GFC_CAF_COARRAY_NOCOARRAY
- || (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_NATIVE))
+ || (flag_coarray != GFC_FCOARRAY_LIB && flag_coarray != GFC_FCOARRAY_SHARED))
{
tmp = build_call_expr_loc (input_location,
builtin_decl_explicit (BUILT_IN_FREE), 1,
@@ -1476,10 +1475,10 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
gfc_add_expr_to_block (&non_null, tmp);
}
}
- else if (flag_coarray == GFC_FCOARRAY_NATIVE
+ else if (flag_coarray == GFC_FCOARRAY_SHARED
&& coarray_dealloc_mode >= GFC_CAF_COARRAY_ANALYZE)
{
- tmp = build_call_expr_loc(input_location, gfor_fndecl_nca_coarray_free,
+ tmp = build_call_expr_loc(input_location, gfor_fndecl_cas_coarray_free,
2, gfc_build_addr_expr (pvoid_type_node, orig_desc),
build_int_cst(integer_type_node, GFC_NCA_NORMAL_COARRAY));
gfc_add_expr_to_block (&non_null, tmp);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 974785f..b49ba32 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -895,18 +895,18 @@ extern GTY(()) tree gfor_fndecl_caf_is_present;
/* Native coarray library function decls. */
-extern GTY(()) tree gfor_fndecl_nca_this_image;
-extern GTY(()) tree gfor_fndecl_nca_num_images;
-extern GTY(()) tree gfor_fndecl_nca_coarray_allocate;
-extern GTY(()) tree gfor_fndecl_nca_coarray_free;
-extern GTY(()) tree gfor_fndecl_nca_sync_images;
-extern GTY(()) tree gfor_fndecl_nca_sync_all;
-extern GTY(()) tree gfor_fndecl_nca_lock;
-extern GTY(()) tree gfor_fndecl_nca_unlock;
-extern GTY(()) tree gfor_fndecl_nca_reduce_scalar;
-extern GTY(()) tree gfor_fndecl_nca_reduce_array;
-extern GTY(()) tree gfor_fndecl_nca_broadcast_scalar;
-extern GTY(()) tree gfor_fndecl_nca_broadcast_array;
+extern GTY(()) tree gfor_fndecl_cas_this_image;
+extern GTY(()) tree gfor_fndecl_cas_num_images;
+extern GTY(()) tree gfor_fndecl_cas_coarray_allocate;
+extern GTY(()) tree gfor_fndecl_cas_coarray_free;
+extern GTY(()) tree gfor_fndecl_cas_sync_images;
+extern GTY(()) tree gfor_fndecl_cas_sync_all;
+extern GTY(()) tree gfor_fndecl_cas_lock;
+extern GTY(()) tree gfor_fndecl_cas_unlock;
+extern GTY(()) tree gfor_fndecl_cas_reduce_scalar;
+extern GTY(()) tree gfor_fndecl_cas_reduce_array;
+extern GTY(()) tree gfor_fndecl_cas_broadcast_scalar;
+extern GTY(()) tree gfor_fndecl_cas_broadcast_array;
/* Math functions. Many other math functions are handled in
trans-intrinsic.c. */