This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fix the extent calculation when upper bounds are less than lower bounds
ClosedPublic

Authored by PeteSteinfeld on Aug 10 2021, 8:22 AM.

Details

Summary

When the upper bound is less than the lower bound, the extent is zero. This is
specified in section 8.5.8.2, paragraph 3.

Note that similar problems exist in the lowering code. This change only fixes
the problem for the front end.

I also added a test.

Diff Detail

Event Timeline

PeteSteinfeld created this revision.Aug 10 2021, 8:22 AM
PeteSteinfeld requested review of this revision.Aug 10 2021, 8:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2021, 8:22 AM
PeteSteinfeld added a project: Restricted Project.
klausler requested changes to this revision.Aug 10 2021, 9:36 AM
klausler added inline comments.
flang/lib/Evaluate/shape.cpp
24

This line forward declares a class name that you never define nor use later.

This revision now requires changes to proceed.Aug 10 2021, 9:36 AM
PeteSteinfeld added inline comments.Aug 10 2021, 10:10 AM
flang/lib/Evaluate/shape.cpp
24

D'oh! Thanks for catching this.

Responding to Peter's comment.

klausler accepted this revision.Aug 10 2021, 10:14 AM
This revision is now accepted and ready to land.Aug 10 2021, 10:14 AM
This revision was landed with ongoing or failed builds.Aug 10 2021, 10:37 AM
This revision was automatically updated to reflect the committed changes.