This improves an error message, avoiding at ... at.

gcc/fortran/ChangeLog:

	PR fortran/24878
	* interface.cc (compare_parameter): Better wording on
	error message.

gcc/testsuite/ChangeLog:

	PR fortran/24878
	* gfortran.dg/interface_51.f90: Adjust expected error message.
This commit is contained in:
Thomas Koenig 2025-02-10 21:25:37 +01:00
parent 118a6c3247
commit d2ff1b78d7
2 changed files with 5 additions and 5 deletions

View file

@ -2521,9 +2521,9 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
gcc_assert (formal->attr.function);
if (!gfc_compare_types (&global_asym->ts, &formal->ts))
{
gfc_error ("Type mismatch passing global function %qs "
"declared at %L at %L (%s/%s)",
actual_name, &gsym->where, &actual->where,
gfc_error ("Type mismatch at %L passing global "
"function %qs declared at %L (%s/%s)",
&actual->where, actual_name, &gsym->where,
gfc_typename (&global_asym->ts),
gfc_dummy_typename (&formal->ts));
return false;

View file

@ -14,7 +14,7 @@ program memain
call foo(subr) ! { dg-error "Passing global subroutine" }
call bar(i4) ! { dg-error "Passing global function" }
call baz(r4) ! { dg-error "Type mismatch passing global function" }
call baz(r4) ! { dg-error "Type mismatch" }
end program memain
subroutine foo(ifun)
@ -39,7 +39,7 @@ integer(kind=4) function i4() ! { dg-error "Passing global function" }
i4 = 42
end function i4
real(kind=4) function r4() ! { dg-error "Type mismatch passing global function" }
real(kind=4) function r4() ! { dg-error "Type mismatch" }
r4 = 1.0
end function r4