This is an archive of the discontinued LLVM Phabricator instance.

[flang] Tune handling of LEN type parameter discrepancies on ALLOCATE
ClosedPublic

Authored by klausler on Mar 21 2023, 3:13 PM.

Details

Summary

Presently, semantics doesn't check for discrepancies between known
constant corresponding LEN type parameters between the declared type
of an allocatable/pointer and either the type-spec or the SOURCE=/MOLD=
on an ALLOCATE statement.

This allows discrepancies between character lengths to go unchecked.
Some compilers accept mismatched character lengths on SOURCE=/MOLD=
and the allocate object, and that's useful and unambiguous feature
that already works in f18 via truncation or padding. A portability
warning should issue, however.

But for mismatched character lengths between an allocate object and
an explicit type-spec, and for any mismatch between derived type
LEN type parameters, an error is appropriate.

Diff Detail

Event Timeline

klausler created this revision.Mar 21 2023, 3:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 3:13 PM
klausler requested review of this revision.Mar 21 2023, 3:13 PM
PeteSteinfeld accepted this revision.Mar 21 2023, 5:05 PM

All builds and tests correctly and looks good.

This revision is now accepted and ready to land.Mar 21 2023, 5:05 PM