+2014-12-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/45859
+ * expr.c (gfc_is_simply_contiguous): Optionally permit array elements.
+ (gfc_check_pointer_assign): Update call.
+ * interface.c (compare_parameter): Ditto.
+ * trans-array.c (gfc_conv_array_parameter): Ditto.
+ * trans-intrinsic.c (gfc_conv_intrinsic_transfer,
+ conv_isocbinding_function): Ditto.
+ * gfortran.h (gfc_is_simply_contiguous): Update prototype.
+
2014-12-12 Tobias Burnus <burnus@net-b.de>
PR fortran/68815
and F2008 must be allowed. */
if (rvalue->rank != 1)
{
- if (!gfc_is_simply_contiguous (rvalue, true))
+ if (!gfc_is_simply_contiguous (rvalue, true, false))
{
gfc_error ("Rank remapping target must be rank 1 or"
" simply contiguous at %L", &rvalue->where);
a "(::1)" is accepted. */
bool
-gfc_is_simply_contiguous (gfc_expr *expr, bool strict)
+gfc_is_simply_contiguous (gfc_expr *expr, bool strict, bool permit_element)
{
bool colon;
int i;
else if (expr->expr_type != EXPR_VARIABLE)
return false;
- if (expr->rank == 0)
+ if (!permit_element && expr->rank == 0)
return false;
for (ref = expr->ref; ref; ref = ref->next)
gfc_actual_arglist *gfc_copy_actual_arglist (gfc_actual_arglist *);
const char *gfc_extract_int (gfc_expr *, int *);
bool is_subref_array (gfc_expr *);
-bool gfc_is_simply_contiguous (gfc_expr *, bool);
+bool gfc_is_simply_contiguous (gfc_expr *, bool, bool);
bool gfc_check_init_expr (gfc_expr *);
gfc_expr *gfc_build_conversion (gfc_expr *);
/* F2008, C1241. */
if (formal->attr.pointer && formal->attr.contiguous
- && !gfc_is_simply_contiguous (actual, true))
+ && !gfc_is_simply_contiguous (actual, true, false))
{
if (where)
gfc_error ("Actual argument to contiguous pointer dummy %qs at %L "
if (formal->attr.codimension)
{
- /* F2008, 12.5.2.8. */
+ /* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */
+ /* F2015, 12.5.2.8. */
if (formal->attr.dimension
&& (formal->attr.contiguous || formal->as->type != AS_ASSUMED_SHAPE)
&& gfc_expr_attr (actual).dimension
- && !gfc_is_simply_contiguous (actual, true))
+ && !gfc_is_simply_contiguous (actual, true, true))
{
if (where)
gfc_error ("Actual argument to %qs at %L must be simply "
- "contiguous", formal->name, &actual->where);
+ "contiguous or an element of such an array",
+ formal->name, &actual->where);
return 0;
}
&& (actual->symtree->n.sym->attr.asynchronous
|| actual->symtree->n.sym->attr.volatile_)
&& (formal->attr.asynchronous || formal->attr.volatile_)
- && actual->rank && formal->as && !gfc_is_simply_contiguous (actual, true)
+ && actual->rank && formal->as
+ && !gfc_is_simply_contiguous (actual, true, false)
&& ((formal->as->type != AS_ASSUMED_SHAPE
&& formal->as->type != AS_ASSUMED_RANK && !formal->attr.pointer)
|| formal->attr.contiguous))
&& ref->u.ar.as->type != AS_ASSUMED_RANK
&& ref->u.ar.as->type != AS_ASSUMED_SHAPE)
||
- gfc_is_simply_contiguous (expr, false));
+ gfc_is_simply_contiguous (expr, false, true));
no_pack = contiguous && no_pack;
}
if (g77 || (fsym && fsym->attr.contiguous
- && !gfc_is_simply_contiguous (expr, false)))
+ && !gfc_is_simply_contiguous (expr, false, true)))
{
tree origptr = NULL_TREE;
source_type = gfc_get_element_type (TREE_TYPE (argse.expr));
/* Repack the source if not simply contiguous. */
- if (!gfc_is_simply_contiguous (arg->expr, false))
+ if (!gfc_is_simply_contiguous (arg->expr, false, true))
{
tmp = gfc_build_addr_expr (NULL_TREE, argse.expr);
{
if (arg->expr->rank == 0)
gfc_conv_expr_reference (se, arg->expr);
- else if (gfc_is_simply_contiguous (arg->expr, false))
+ else if (gfc_is_simply_contiguous (arg->expr, false, false))
gfc_conv_array_parameter (se, arg->expr, true, NULL, NULL, NULL);
else
{
+2014-12-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/45859
+ * gfortran.dg/coarray_args_2.f90: Remove dg-error.
+
2015-12-12 David Edelsohn <dje.gcc@gmail.com>
* gcc.target/powerpc/pr67808.c: Add -mlong-double-128 option.
sync all
call subr(ndim, a(1:1,2)) ! OK
- call subr(ndim, a(1,2)) ! { dg-error "must be simply contiguous" }
- ! See also F08/0048 and PR 45859 about the validity
+ call subr(ndim, a(1,2)) ! See also F08/0048 and PR 45859 about the validity
if (this_image() == 1) then
write(*, *) 'OK'
end if