This is an archive of the discontinued LLVM Phabricator instance.

[flang][RFC] Support arguments rank mismatch
AbandonedPublic

Authored by peixin on Oct 12 2022, 5:31 AM.

Details

Summary

As F2018 15.4.3.2 (6), the specification part of an interface body may
specify attributes or define values for data entities that do not
determine characteristics of the procedure. Such specifications have no
effect.

The case of passing arguments of rank mismatch hits one assert when
the actual argument is assumed-shape array and the dummy has different
rank. The case is from one actual workload GSI:
https://github.com/NOAA-EMC/GSI/blob/48d8676e870a6493ad6972c3785ef4493ab5d5d9/src/gsi/m_rerank.f90#L283-L291

Support this by reboxing the actual argument with the dummy argument
shape.

Fixes #57620.

Diff Detail

Event Timeline

peixin created this revision.Oct 12 2022, 5:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 5:31 AM
peixin requested review of this revision.Oct 12 2022, 5:31 AM
klausler requested changes to this revision.Oct 12 2022, 8:31 AM

The program is non-conforming and non-portable. The characteristics of the dummy argument "i2" in the explicit interface ext_interface affect the characteristics of the procedure because i2 is a dummy argument.

This revision now requires changes to proceed.Oct 12 2022, 8:31 AM
peixin abandoned this revision.Oct 26 2022, 7:30 AM

Thanks @klausler for the explanations.

The fix for the Fortran source code has been proposed in https://github.com/llvm/llvm-project/issues/57620#issuecomment-1277138294 and submitted to NOAA (owner of GSI) (https://github.com/NOAA-EMC/GSI/pull/489). I had planned to close this PR after updating from NOAA, but it is inactive since Aug 27, 2022 and the review may take a long time.

Abandon this PR and will update the issue #57620 after having updates from NOAA.