[flang] Move checks for valid array-spec to check-declarations.cc
authorTim Keith <tkeith@nvidia.com>
Tue, 14 Jan 2020 20:06:52 +0000 (12:06 -0800)
committerTim Keith <tkeith@nvidia.com>
Tue, 14 Jan 2020 20:06:52 +0000 (12:06 -0800)
commit889c81eae79f7ecca49ca0381f13785a33b85c84
tree2b7a3e2f523be3c3207018c43c3ead5af9e43dc3
parent605d79eaeb3d78ae373d29a4c03408d9e47294d7
[flang] Move checks for valid array-spec to check-declarations.cc

At the time we finish processing an array-spec in `resolve-names.cc`,
we don't know if the entity is going to be declared ALLOCATABLE later
so we can't check for validity there. In the new test in `resolve58.f90`
(based on issue flang-compiler/f18#930) we were reporting an error on `b` and not on `a`
when it should be the reverse.

The fix is to move array-spec checking to `check-declarations.cc`,
after name resolution is complete.

Fixes flang-compiler/f18#930.

Original-commit: flang-compiler/f18@c596d2fef7628236676c1939659f4eb956e4df35
Reviewed-on: https://github.com/flang-compiler/f18/pull/933
flang/lib/semantics/check-declarations.cc
flang/lib/semantics/resolve-names.cc
flang/test/semantics/resolve58.f90
flang/test/semantics/resolve61.f90