Commit bf9d2177 by Jakub Jelinek Committed by Jakub Jelinek

interface.c (compare_actual_formal): Issue error when attempting to pass an…

interface.c (compare_actual_formal): Issue error when attempting to pass an assumed-size array as assumed-shape...

	* interface.c (compare_actual_formal): Issue error when attempting
	to pass an assumed-size array as assumed-shape array argument.

	* gfortran.dg/assumed_dummy_2.f90: New test.

From-SVN: r105765
parent 2c47f875
2005-10-21 Jakub Jelinek <jakub@redhat.com>
* interface.c (compare_actual_formal): Issue error when attempting
to pass an assumed-size array as assumed-shape array argument.
2005-10-20 Erik Edelmann <erik.edelmann@iki.fi> 2005-10-20 Erik Edelmann <erik.edelmann@iki.fi>
PR fortran/21625 PR fortran/21625
......
...@@ -1235,6 +1235,21 @@ compare_actual_formal (gfc_actual_arglist ** ap, ...@@ -1235,6 +1235,21 @@ compare_actual_formal (gfc_actual_arglist ** ap,
return 0; return 0;
} }
if (f->sym->as
&& f->sym->as->type == AS_ASSUMED_SHAPE
&& a->expr->expr_type == EXPR_VARIABLE
&& a->expr->symtree->n.sym->as
&& a->expr->symtree->n.sym->as->type == AS_ASSUMED_SIZE
&& (a->expr->ref == NULL
|| (a->expr->ref->type == REF_ARRAY
&& a->expr->ref->u.ar.type == AR_FULL)))
{
if (where)
gfc_error ("Actual argument for '%s' cannot be an assumed-size"
" array at %L", f->sym->name, where);
return 0;
}
if (a->expr->expr_type != EXPR_NULL if (a->expr->expr_type != EXPR_NULL
&& compare_pointer (f->sym, a->expr) == 0) && compare_pointer (f->sym, a->expr) == 0)
{ {
......
2005-10-21 Jakub Jelinek <jakub@redhat.com>
* gfortran.dg/assumed_dummy_2.f90: New test.
2005-10-21 James E Wilson <wilson@specifix.com> 2005-10-21 James E Wilson <wilson@specifix.com>
PR preprocessor/15220 PR preprocessor/15220
! { dg-do compile }
double precision :: arr(5, 8)
call bar (arr)
contains
subroutine foo (arr)
double precision :: arr(:,:)
arr(3, 4) = 24
end subroutine foo
subroutine bar (arr)
double precision :: arr(5,*)
call foo (arr) ! { dg-error "cannot be an assumed-size array" }
call foo (arr (:, :8))
end subroutine
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment