This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix conformability checking for intrinsic arguments
ClosedPublic

Authored by PeteSteinfeld on Jun 25 2021, 11:29 AM.

Details

Summary

There are situations where the arguments of intrinsics must be conformable,
which is defined in section 3.36. This means they must have "the same shape,
or one being an array and the other being scalar". But the check we were
actually making was that their ranks were the same.

This change fixes that and adds a test for the UNPACK intrinsic, where the
FIELD argument "shall be conformable with MASK".

Diff Detail

Event Timeline

PeteSteinfeld created this revision.Jun 25 2021, 11:29 AM
PeteSteinfeld requested review of this revision.Jun 25 2021, 11:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2021, 11:29 AM
PeteSteinfeld added a project: Restricted Project.

Why isn't the conformance checking that's implied by the definition of UNPACK in the intrinsics table catching this case? Is it because it only checks rank? If so, you should put this extra compile-time checking into the general argument conformance checking, and it'll apply to more intrinsics than just UNPACK.

flang/lib/Evaluate/intrinsics.cpp
2165

spelling

Responding to Peter's comments. In particular, it looks like the check I added
for the UNPACK intrinsic was changed to a more general fix for determining
conformability of intrinsic arguments in general.

PeteSteinfeld retitled this revision from [flang] Implement semantic check for the UNPACK intrinsic to [flang] Fix conformability checking for intrinsic arguments.Jun 28 2021, 9:31 AM
PeteSteinfeld edited the summary of this revision. (Show Details)
klausler accepted this revision.Jun 28 2021, 10:41 AM
This revision is now accepted and ready to land.Jun 28 2021, 10:41 AM
This revision was automatically updated to reflect the committed changes.