aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2011-07-16 19:31:13 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2011-07-16 19:31:13 +0200
commitbadd9e6941c34112f782bf955877fe041dd20cc4 (patch)
treeb24dfbdc16df4c03a65f16b253941afeb464c428 /gcc/fortran/expr.c
parent0fa714476569f264d2b40130d06ba2b16cecdb3e (diff)
downloadgcc-badd9e6941c34112f782bf955877fe041dd20cc4.zip
gcc-badd9e6941c34112f782bf955877fe041dd20cc4.tar.gz
gcc-badd9e6941c34112f782bf955877fe041dd20cc4.tar.bz2
expr.c (gfc_ref_this_image): New function.
2011-07-16 Tobias Burnus <burnus@net-b.de> * expr.c (gfc_ref_this_image): New function. (gfc_is_coindexed): Use it. * gfortran.h (gfc_ref_this_image): New prototype. * resolve.c (resolve_deallocate_expr, resolve_allocate_expr): Support alloc scalar coarrays. * trans-array.c (gfc_conv_array_ref, gfc_array_init_size, gfc_conv_descriptor_cosize, gfc_array_allocate, gfc_trans_deferred_array): Ditto. * trans-expr.c (gfc_conv_variable) Ditto.: * trans-stmt.c (gfc_trans_deallocate): Ditto. * trans-types.c (gfc_get_element_type, gfc_get_array_type_bounds gfc_get_array_descr_info): Ditto. * trans-decl.c (gfc_get_symbol_decl): Ditto. 2011-07-16 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray_14.f90: Remove dg-error "sorry not * implemented". * gfortran.dg/coarray_7.f90: Ditto. * gfortran.dg/coarray/scalar_alloc_1.f90: New. * gfortran.dg/coarray/scalar_alloc_2.f90: New. From-SVN: r176358
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 6db0836..3bf1e94 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4126,18 +4126,28 @@ gfc_expr_replace_comp (gfc_expr *expr, gfc_component *dest)
bool
+gfc_ref_this_image (gfc_ref *ref)
+{
+ int n;
+
+ gcc_assert (ref->type == REF_ARRAY && ref->u.ar.codimen > 0);
+
+ for (n = ref->u.ar.dimen; n < ref->u.ar.dimen + ref->u.ar.codimen; n++)
+ if (ref->u.ar.dimen_type[n] != DIMEN_THIS_IMAGE)
+ return false;
+
+ return true;
+}
+
+
+bool
gfc_is_coindexed (gfc_expr *e)
{
gfc_ref *ref;
for (ref = e->ref; ref; ref = ref->next)
if (ref->type == REF_ARRAY && ref->u.ar.codimen > 0)
- {
- int n;
- for (n = ref->u.ar.dimen; n < ref->u.ar.dimen + ref->u.ar.codimen; n++)
- if (ref->u.ar.dimen_type[n] != DIMEN_THIS_IMAGE)
- return true;
- }
+ return !gfc_ref_this_image (ref);
return false;
}