This is an archive of the discontinued LLVM Phabricator instance.

[flang] Don't emit false errors on LBOUND/UBOUND of assumed-rank arrays
ClosedPublic

Authored by klausler on Jul 31 2023, 4:11 PM.

Details

Summary

Folding of LBOUND/UBOUND on assumed-rank arrays could lead to bogus errors
later. This is a regression from a recent change intended to ensure that
patently bad DIM= arguments were caught even in the case of assumed-rank.
Rearrange the order of checks so that those bad DIM= argument values are
caught but otherwise defer LBOUND/UBOUND of assumed-rank arguments to
run time. (It was tempting to always fold LBOUND(ar,DIM=n) to 1, but
that would obscure the run time error required when 'n' is out of bounds,
including the case of a scalar 'ar'.)

Diff Detail

Event Timeline

klausler created this revision.Jul 31 2023, 4:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 4:11 PM
klausler requested review of this revision.Jul 31 2023, 4:11 PM
PeteSteinfeld accepted this revision.Jul 31 2023, 7:36 PM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Jul 31 2023, 7:36 PM