[flang-commits] [PATCH] D146583: [flang] Tune handling of LEN type parameter discrepancies on ALLOCATE

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Mar 21 15:13:59 PDT 2023


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

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.


https://reviews.llvm.org/D146583

Files:
  flang/docs/Extensions.md
  flang/lib/Semantics/check-allocate.cpp
  flang/test/Semantics/allocate07.f90
  flang/test/Semantics/allocate09.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146583.507152.patch
Type: text/x-patch
Size: 20925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230321/d0524c8c/attachment-0001.bin>


More information about the flang-commits mailing list