[all-commits] [llvm/llvm-project] bb6fae: [flang] Tune handling of LEN type parameter discre...

Peter Klausler via All-commits all-commits at lists.llvm.org
Mon Mar 27 17:01:55 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb6faec1818026a5b7ead29ff98511784ce2cfdd
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2023-03-27 (Mon, 27 Mar 2023)

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

  Log Message:
  [flang] Tune handling of LEN type parameter discrepancies on ALLOCATE

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.

Differential Revision: https://reviews.llvm.org/D146583

More information about the All-commits mailing list