[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