Hi Thomas,
Am 08.02.25 um 15:31 schrieb Thomas Koenig:
Hello world,
this fixes a rather old PR from 2005, where a subroutine
could be passed and called as a function. This patch checks
for that, also for the reverse, and for wrong types of functions.
looks good, just two minor comments:
+ actual_name = act_sym->name ? act_sym->name : act_sym->name;
Why not just
+ actual_name = act_sym->name;
?
+ gfc_error ("Type mismatch passing global function %qs
"
+ "declared at %L at %L (%s/%s)",
actual_name,
+ &gsym->where, &actual->where,
+ gfc_typename (&global_asym->ts),
+ gfc_dummy_typename (&formal->ts));
These result in lines exceeding column 80.
I am also not a native speaker, but "at %L at %L" sounds strange to me.
Could you find a minor rewording?
I expect that this will find a few bugs in dusty deck code...
... we'll see ... ;-)
Regression-tested. OK for trunk?
OK. Thanks for the patch!
Harald
Best regards
Thomas
Test procedure dummy arguments against global symbols, if available.
gcc/fortran/ChangeLog:
PR fortran/24878
* interface.cc (compare_parameter): Check global subroutines
passed as actual arguments for subroutine / function and
function type.
gcc/testsuite/ChangeLog:
PR fortran/24878
* gfortran.dg/interface_51.f90: New test.