PSyclone icon indicating copy to clipboard operation
PSyclone copied to clipboard

InlineTrans (and PSyIR) does not support routine arguments with the `optional` attribute.

Open arporter opened this issue 1 year ago • 1 comments

InlineTrans will refuse to countenance a routine if it has optional arguments since they end up as DataSymbols of UnknownFortranType. This is an issue for the NEMO sea-ice code. We could probably add support for the optional attribute @sergisiso?

arporter avatar Mar 22 '24 08:03 arporter

I don't see any issue adding support for the optional attribute (other than the more complicated logic when we want to match signatures for caller-callee like in the InlineTrans, but this is specifically what we want them for).

sergisiso avatar Mar 22 '24 09:03 sergisiso

This pull request (currently under review by Andy) https://github.com/stfc/PSyclone/pull/2775 will provide the subroutine get_argument_routine_match(...) which returns a list of the indices of the matching arguments from a call to a subroutine with support for optional as well as named arguments. Once this is accepted, updating the inlining with respect should be easy with this list.

schreiberx avatar Nov 16 '24 21:11 schreiberx

@arporter , can this be closed now?

hiker avatar Oct 08 '25 13:10 hiker

I think so. The fact that PSyIR doesn't directly support the optional attribute can be tackled separately if anyone cares :-)

arporter avatar Oct 08 '25 13:10 arporter