[all-commits] [llvm/llvm-project] a94b72: [flang] Improve error message for misuse of NULL(m...

Peter Klausler via All-commits all-commits at lists.llvm.org
Thu Oct 28 15:20:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a94b721d2607ee2eda9942c892160e89bd284cb2
      https://github.com/llvm/llvm-project/commit/a94b721d2607ee2eda9942c892160e89bd284cb2
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2021-10-28 (Thu, 28 Oct 2021)

  Changed paths:
    M flang/include/flang/Semantics/expression.h
    M flang/lib/Semantics/expression.cpp
    M flang/test/Semantics/data01.f90
    M flang/test/Semantics/null-init.f90

  Log Message:
  -----------
  [flang] Improve error message for misuse of NULL(mold) as data statement constant

While "null()" is accepted as a data statement constant when it
corresponds to a pointer object, "null(mold=p)" and "null(p)"
are not allowed.  The current error messages simply complain
that null is not an array.  This patch adds a context-sensitive
message to the effect that a data statement constant followed
by non-empty parentheses must be an array or structure constructor.

(Note that f18 can't simply special-case the name "null" when parsing
data statement constants, since programs are free to repurpose that
name as an array or derived type.)

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




More information about the All-commits mailing list