Consider eliminating `type(*)` in the collective subroutines
Fortran 2023 18.3.7 item 7 in the list on page 515 prohibits assumed-type, assumed-rank arguments without the value attribute.
Based on reading of the standard, it looks like the path forward here has to do with separate procedures for different types, and to use select rank internally to dispatch to different bind(c) procedures. There's still work to do in figuring out exactly what that looks like, and is probably worth some conversations with some other committee members as well.
Some of my notes from today's meeting:
- Probably need to bifurcate
prif_co_{min,max}into_numericand_charactervariants aargument to_numericcan probably remaincontiguous type(*)aargument to_characteris probablycontiguous characterwith assumed-length- For ALL
prif_co_*: internally we may need to use select rank to handle the assumed-rank at the Fortran level before hitting C- Which means we need 16 versions of each BIND(C)
caf_call, one for each possible rank
- Which means we need 16 versions of each BIND(C)
- POST-CALL question:
- can we just leverage the
TARGETattribute and callC_LOCon the contiguous assumed-rank dummy arg to bypass the select rank mess?
- can we just leverage the
Taking a fresh look at this, I don't think it's a problem.
A Fortran procedure interface is interoperable with a C function prototype if ... (5) any dummy argument without the VALUE attribute corresponds to a formal parameter of the prototype that is of a pointer type, and ...
- the dummy argument is ... assumed-rank ..., and the formal parameter is a pointer to CFI_cdesc_t
That doesn't say that the dummy argument can't be assumed-type.
C716 An assumed-type actual argument that corresponds to an assumed-rank dummy argument shall be assumed-shape or assumed-rank.
That certainly implies that assumed-type dummy arguments can be assumed-rank.
If flang seems to have a problem with this, we should file a bug report.