[PATCH] D87859: [flang] Unnecessary call to CHECK() for call to NULL() as an actual argument

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 18:55:22 PDT 2020


PeteSteinfeld added a comment.

In D87859#2280407 <https://reviews.llvm.org/D87859#2280407>, @klausler wrote:

> `NULL()` isn't "undefined".  It's a pointer (or in some other contexts, an unallocated allocatable), and the description of `ASSOCIATED()` in 16.9.16 just requires that its first (`POINTER=`) argument be a pointer.
>
> (Even if `NULL()` were undefined, it would be okay -- see paragraph (2) of 16.1, which describes general rules for inquiry functions, of which `ASSOCIATED` is an example.)  "Unless the description of an intrinsic inquiry function states otherwise, these arguments are permitted to be unallocated allocatable variables or pointers that are undefined or disassociated."

This all sounds reasonable to me.  If what you say is all correct, I would expect the call to `ALLOCATED()` to return `.FALSE.`.  But every compiler I've tried (IBM, Intel, PGI, and GNU) all produce compile-time errors.

@klausler, is it your guidance that we should compiler the expression `ALLOCATED(NULL))` without error?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87859/new/

https://reviews.llvm.org/D87859



More information about the llvm-commits mailing list