[flang] Fix creation of deferred shape arrays by POINTER statement
authorPeter Steinfeld <psteinfeld@nvidia.com>
Wed, 20 Jan 2021 20:34:08 +0000 (12:34 -0800)
committerPeter Steinfeld <psteinfeld@nvidia.com>
Wed, 20 Jan 2021 21:08:11 +0000 (13:08 -0800)
commitbebbe64075abf9d9887a8e1ee39c1ecefe970954
treee0fdcc5074d1390ee670e317442915dd884f1c14
parent33a5d212c6198af2bd902bb8e4cfd0f0bec0114f
[flang] Fix creation of deferred shape arrays by POINTER statement

It's possible to  declare deferred shape array using the POINTER
statement, for example:

  POINTER :: var(:)

When analyzing POINTER declarations, we were not capturing the array
specification information, if present.  I fixed this by changing the
"Post" function for "parser::PointerDecl" to check to see if the
declaration contained a "DeferredShapeSpecList".  In such cases, I
analyzed the shape and used to information to declare an "ObjectEntity"
that contains the shape information rather than an "UnknownEntity".

I also added a couple of small tests that fail to compile without these
changes.

Differential Revision: https://reviews.llvm.org/D95080
flang/lib/Semantics/resolve-names-utils.cpp
flang/lib/Semantics/resolve-names-utils.h
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/allocate12.f90