[flang] Analyze intrinsic and user-defined assignments
authorTim Keith <tkeith@nvidia.com>
Sat, 23 Nov 2019 00:46:11 +0000 (16:46 -0800)
committerTim Keith <tkeith@nvidia.com>
Tue, 26 Nov 2019 21:22:17 +0000 (13:22 -0800)
commit18f3a2beef2ed24fc7fe1c1f226ab49af62dc098
tree1105231c1ec0278453af1e4183dce3d38cd67071
parentddb4f259f6c766eb692ead85a1302b214448b8a0
[flang] Analyze intrinsic and user-defined assignments

Change expression analysis to do assignment statements as it currently
does call statements. Check there for defined assignment and set
`typedAssignment` in the `AssignmentStmt` node to contain the analyzed
assignment, either intrinsic or user-defined.
When `var = expr` is implemented by subroutine `sub`, the analyzed
assignment contains a procedure reference to `sub(var, (expr))`.

Add `IsDefinedAssignment` to decide based on types and ranks of lhs
and rhs whether is can be a defined assignment. The result is
tri-state because when they are both the same derived type it can
be either intrinsic or defined. Use this where a similar decision
is made in `check-declarations.cc`.

Change "Procedure referenced in PURE subprogram" error message to
contain the name of the procedure. If the reference is from a defined
assignment that name won't appear on the highlighted source line.

Original-commit: flang-compiler/f18@5c87071210ec74e9395805dd547c107e7d3bf7b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/841
flang/lib/semantics/check-declarations.cc
flang/lib/semantics/expression.cc
flang/lib/semantics/expression.h
flang/lib/semantics/tools.cc
flang/lib/semantics/tools.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/call10.f90
flang/test/semantics/resolve62.f90
flang/test/semantics/resolve63.f90
flang/test/semantics/resolve64.f90
flang/test/semantics/resolve66.f90 [new file with mode: 0644]