diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-04-04 20:35:13 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-04-04 20:35:13 +0200 |
commit | a3935ffcb75885f82b3034c8b45bc54b14b49cff (patch) | |
tree | 9abcba3bcc381b60bb846f373262fa21db1ff878 /gcc/fortran/interface.c | |
parent | b77f9eab26590857d67853ab3edd5e7171315e72 (diff) | |
download | gcc-a3935ffcb75885f82b3034c8b45bc54b14b49cff.zip gcc-a3935ffcb75885f82b3034c8b45bc54b14b49cff.tar.gz gcc-a3935ffcb75885f82b3034c8b45bc54b14b49cff.tar.bz2 |
re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-04-04 Tobias Burnus <burnus@net-b.de>
Mikael Morin <mikael.morin@sfr.fr>
PR fortran/18918
* check.c (is_coarray): Update - because of DIMEN_THIS_IMAGE.
* expr.c (gfc_is_coindexed): Ditto.
* gfortran.h (gfc_array_ref_dimen_type): Add DIMEN_THIS_IMAGE.
* interface.c (compare_parameter): Use gfc_expr_attr and
gfc_is_coindexed.
* resolve.c (check_dimension, compare_spec_to_ref,
resolve_allocate_expr, check_data_variable): Update for
DIMEN_THIS_IMAGE.
* simplify.c (gfc_simplify_lcobound, gfc_simplify_this_image,
gfc_simplify_ucobound): Allow non-constant bounds.
* trans-array.c (gfc_set_loop_bounds_from_array_spec,
gfc_trans_create_temp_array, gfc_trans_constant_array_constructor,
gfc_set_vector_loop_bounds, gfc_conv_array_index_offset,
gfc_start_scalarized_body, gfc_trans_scalarizing_loops,
gfc_trans_scalarized_loop_boundary, gfc_conv_section_startstride,
gfc_conv_ss_startstride, gfc_conv_loop_setup,
gfc_trans_array_bounds, gfc_conv_expr_descriptor,
gfc_walk_variable_expr): Handle codimen.
* trans-decl.c (gfc_build_qualified_array): Save cobounds.
* trans-intrinsic.c (gfc_conv_intrinsic_bound): Use arg2.
(conv_intrinsic_cobound): New function.
(gfc_conv_intrinsic_function): Call it.
(gfc_walk_intrinsic_function, gfc_add_intrinsic_ss_code): Handle
ucobound, lcobound, this_image.
* fortran/trans-types.c (gfc_build_array_type): Save cobounds.
(gfc_get_dtype): Honour corank.
(gfc_get_nodesc_array_type): Save corank and codimensions.
(gfc_get_array_type_bounds): Save cobound.
* fortran/trans.h (gfc_ss_info,gfc_loopinfo): Add codimen item.
(gfc_array_kind): Add corank item.
(GFC_TYPE_ARRAY_CORANK): New macro.
2011-04-04 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* gfortran.dg/coarray_10.f90: Add coarray descriptor diagnostic
check.
* gfortran.dg/coarray_13.f90: Add checks for run-time cobounds.
* gfortran.dg/coarray_15.f90: New.
Co-Authored-By: Mikael Morin <mikael.morin@sfr.fr>
From-SVN: r171949
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index b0b74c1..00fd24a 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1564,8 +1564,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, gfc_ref *last = NULL; if (actual->expr_type != EXPR_VARIABLE - || (actual->ref == NULL - && !actual->symtree->n.sym->attr.codimension)) + || !gfc_expr_attr (actual).codimension) { if (where) gfc_error ("Actual argument to '%s' at %L must be a coarray", @@ -1573,15 +1572,16 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, return 0; } + if (gfc_is_coindexed (actual)) + { + if (where) + gfc_error ("Actual argument to '%s' at %L must be a coarray " + "and not coindexed", formal->name, &actual->where); + return 0; + } + for (ref = actual->ref; ref; ref = ref->next) { - if (ref->type == REF_ARRAY && ref->u.ar.codimen != 0) - { - if (where) - gfc_error ("Actual argument to '%s' at %L must be a coarray " - "and not coindexed", formal->name, &ref->u.ar.where); - return 0; - } if (ref->type == REF_ARRAY && ref->u.ar.as->corank && ref->u.ar.type != AR_FULL && ref->u.ar.dimen != 0) { @@ -1595,14 +1595,6 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, last = ref; } - if (last && !last->u.c.component->attr.codimension) - { - if (where) - gfc_error ("Actual argument to '%s' at %L must be a coarray", - formal->name, &actual->where); - return 0; - } - /* F2008, 12.5.2.6. */ if (formal->attr.allocatable && ((last && last->u.c.component->as->corank != formal->as->corank) |