This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fold IS_CONTIGUOUS for TYPE(*) when possible
ClosedPublic

Authored by jeanPerier on Apr 12 2023, 6:54 AM.

Details

Summary

TYPE(*) arguments fell through in IS_CONTIGUOUS folding
because they are not Expr<SomeType>. Expose entry point for
symbols in IsContiguous and use that.

The added test revealed that IS_CONTIGUOUS was folded to
false for assumed rank arguments. Fix this: the contiguity of
assumed rank without the CONTIGUOUS argument can only be
verified at runtime.

Diff Detail

Event Timeline

jeanPerier created this revision.Apr 12 2023, 6:54 AM
Herald added a project: Restricted Project. · View Herald Transcript
jeanPerier requested review of this revision.Apr 12 2023, 6:54 AM
klausler accepted this revision.Apr 12 2023, 8:21 AM
This revision is now accepted and ready to land.Apr 12 2023, 8:21 AM
PeteSteinfeld requested changes to this revision.Apr 12 2023, 10:19 AM

Please make the change to fix the build error.

flang/lib/Evaluate/check-expression.cpp
772–774

I'm seeing compilation errors here because the variable details is not used, and my build has -Werror=unused-variable defined.

I'm using GCC 9.3.0.

If I change line 773 to just check against nullptr, everything builds and tests correctly.

This revision now requires changes to proceed.Apr 12 2023, 10:19 AM
klausler added inline comments.Apr 12 2023, 10:31 AM
flang/lib/Evaluate/check-expression.cpp
772–774

I suggest recoding as else if (ultimate.has<...>()) {.

Fix warning. Thanks for noticing it and for the suggestion.

PeteSteinfeld accepted this revision.Apr 13 2023, 7:51 AM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Apr 13 2023, 7:51 AM
This revision was automatically updated to reflect the committed changes.