Fix a function decl in gfortran
Tobias Burnus
burnus@net-b.de
Tue Jun 3 21:48:00 GMT 2014
Bernd Schmidt wrote:
> There's at least one more such problem with gfortran, which I'm having
> a harder time debugging. It occurs in
> gfortran.fortran-torture/compile/mloc.f90
That's minloc/maxloc, which takes three arguments on the Fortran side:
An array, optionally a dimension ("dim") and optionally an array-valued
mask (same shape as "array").
> while the actual library function (and the call to it) only has three
> arguments:
> void
> mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
> gfc_array_r4 * const restrict array,
> gfc_array_l1 * const restrict mask)
>
> The decl is constructed by gfc_get_function_type. It seems to think
> there's one extra parameter named "dim" between "array" and "mask".
There are two functions groups called with mask, cf. iresolve.c's
gfc_resolve_minloc. Namely, without dim "mmin0_<kind>_<type>" and with
dim "mmin1_<kind>_<type>". – The latter takes "dim" as additional argument.
Thus, for mmin1_* the generated decl is fine, for mmin0_ is is not. I do
not immediately see where the "dim" argument is skipped – but some
similar special-case handling would then be also needed for the function
declaration.
Tobias
More information about the Fortran
mailing list