This is an archive of the discontinued LLVM Phabricator instance.

[flang] Correct the subscripts used for arguments to character intrinsics
ClosedPublic

Authored by klausler on Jun 15 2021, 3:24 PM.

Details

Summary

When chasing down another unrelated bug, I noticed that the
implementations of various character intrinsic functions assume
that the lower bounds of (some of) their arguments were 1.
This isn't necessarily the case, so I've cleaned them up, tweaked
the unit tests to exercise the fix, and regularized the allocation
pattern used for results to use SetBounds() before Allocate() rather
than the old original Descriptor::Allocate() wrapper around
CFI_allocate().

Since there were few other remaining uses of the old original
Descriptor::Allocate() wrapper, I also converted them to the
new one and deleted the old one.

Diff Detail

Event Timeline

klausler created this revision.Jun 15 2021, 3:24 PM
klausler requested review of this revision.Jun 15 2021, 3:24 PM
PeteSteinfeld accepted this revision.Jun 15 2021, 8:04 PM

All builds, tests, and looks good.

flang/runtime/descriptor.h
309–310

I didn't understand the "(re)the" part of this comment.

This revision is now accepted and ready to land.Jun 15 2021, 8:04 PM
klausler added inline comments.Jun 16 2021, 9:22 AM
flang/runtime/descriptor.h
309–310

It's a typo, will fix.

Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2021, 10:26 AM