[flang] Check bounds on pointer assignment
authorTim Keith <tkeith@nvidia.com>
Wed, 22 Jan 2020 01:15:21 +0000 (17:15 -0800)
committerTim Keith <tkeith@nvidia.com>
Wed, 22 Jan 2020 21:50:02 +0000 (13:50 -0800)
commitd1337ba3ee023273525019c1cfdd587c6f90f8bd
tree78a14fad188142767fc156b958fafb03497b3d80
parentd4a1bd7c9a2d382c0a4ea7ea3cd95707c5db1aba
[flang] Check bounds on pointer assignment

Perform checks on bounds-spec and bounds-remapping in a pointer
assignment statement:
- check that the rank of the bounds specified matches the rank of the
  pointer
- for bounds-spec, check that the pointer rank matches the target rank
- for bounds-remapping:
  - check that the target is rank 1 or simply contiguous
  - check that there are sufficient elements on the RHS for the bounds
    specified, when it can be determined at compile time

Move more of the pointer-specific checking from `assignment.cc`
to `pointer-assignment.cc`.

Original-commit: flang-compiler/f18@7489b3539224f8ad7a55873916e5854510236218
Reviewed-on: https://github.com/flang-compiler/f18/pull/944
flang/lib/semantics/assignment.cc
flang/lib/semantics/pointer-assignment.cc
flang/lib/semantics/pointer-assignment.h
flang/test/semantics/assign02.f90
flang/test/semantics/assign03.f90