This patch removes an incorrect assertion. A user-friendly error for this
case is already given elsewhere.
2022-01-05 Steve Kargl <kargl@gcc.gnu.org>
Sandra Loosemore <sandra@codesourcery.com>
PR fortran/103287
gcc/fortran/
* interface.c (argument_rank_mismatch): Replace incorrect assertion
with return.
gcc/testsuite/
* gfortran.dg/c-interop/pr103287-1.f90: new.
* gfortran.dg/c-interop/pr103287-2.f90: new.
}
else
{
- gcc_assert (rank2 != -1);
+ if (rank2 == -1)
+ /* This is an assumed rank-actual passed to a function without
+ an explicit interface, which is already diagnosed in
+ gfc_procedure_use. */
+ return;
if (rank1 == 0)
gfc_error_opt (0, "Rank mismatch between actual argument at %L "
"and actual argument at %L (scalar and rank-%d)",
--- /dev/null
+! { dg-do compile }
+
+subroutine g
+ call s([1])
+end
+subroutine h(x)
+ integer, pointer :: x(..)
+ call s(x) ! { dg-error "Assumed-rank argument requires an explicit interface" }
+end
--- /dev/null
+! { dg-do compile }
+
+subroutine g
+ call s(1)
+end
+subroutine h(x)
+ integer, pointer :: x(..)
+ call s(x) ! { dg-error "Assumed-rank argument requires an explicit interface" }
+end