[flang] Fix checking of pointer target with association
authorTim Keith <tkeith@nvidia.com>
Wed, 15 Jan 2020 21:43:05 +0000 (13:43 -0800)
committerTim Keith <tkeith@nvidia.com>
Wed, 15 Jan 2020 21:43:05 +0000 (13:43 -0800)
commit628a35907168e3c70c2835322b3a919b902f3850
tree9061193ec96dbd53c80d82a7c764b8d4d90c4fad
parentf4e8eb5d4137bc434af5141e6981ad5c1a44609c
[flang] Fix checking of pointer target with association

When checking if the target of a pointer assignment is valid, we
weren't following associations. E.g. we complained about the assignment
below if `b` had the TARGET attribute but `c` did not:
```
associate(a => b%c)
  p => a
end associate
```

The fix is to change `GetSymbolVector()` to follow associations in
creating the chain of symbols from a designator.

Add tests for this, and also some other cases where TARGET is on the
derived type variable rather than the component (which worked but didn't
have tests).

Original-commit: flang-compiler/f18@c81c6baedd41d6ca2d36c81ca745a144c02be369
Reviewed-on: https://github.com/flang-compiler/f18/pull/937
flang/lib/evaluate/tools.cc
flang/lib/semantics/pointer-assignment.cc
flang/test/semantics/assign02.f90