This is an archive of the discontinued LLVM Phabricator instance.

[flang] Handle reversed bounds and negative length in inlined allocation
ClosedPublic

Authored by clementval on Jun 13 2022, 1:33 AM.

Details

Summary

ALLOCATE statement allows reversed bounds (see Fortran 2018 9.7.1.2
point 1) in which case the extents are zero.

The same applies for the character length provided in the type spec that
can be negative. In which case the new length is zero.

Use genMaxWithZero to deal with these cases.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Jean Perier <jperier@nvidia.com>

Diff Detail

Event Timeline

clementval created this revision.Jun 13 2022, 1:33 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 13 2022, 1:33 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Jun 13 2022, 1:33 AM
clementval retitled this revision from Handle reversed bounds and negative length in inlined allocation to [flang] Handle reversed bounds and negative length in inlined allocation.Jun 13 2022, 1:54 AM
jeanPerier accepted this revision.Jun 13 2022, 6:37 AM
This revision is now accepted and ready to land.Jun 13 2022, 6:37 AM
PeteSteinfeld accepted this revision.Jun 13 2022, 6:49 AM

All builds and tests correctly and looks good.