[flang] Detect incorrect use of assumed-type dummy arguments
authorTim Keith <tkeith@nvidia.com>
Fri, 10 Jan 2020 22:09:39 +0000 (14:09 -0800)
committerTim Keith <tkeith@nvidia.com>
Fri, 10 Jan 2020 22:51:40 +0000 (14:51 -0800)
commit1243a0d1751cc44a8f20663dc056a1c0ff3fe20e
tree492f64ba1373d2e707dc338e6ce61b4e93d32b4f
parentb37ba4d3e315bc5dd126fab97d4d49289a145dc5
[flang] Detect incorrect use of assumed-type dummy arguments

Assumed-type dummy arguments can only be used as actual arguments. If
they are used in other contexts it is an error. Change argument analysis
to handle these differently depending on the context. `allowAssumedType`
is set when the argument can be assumed-type. These expressions now all
get `typedExpr` set to `nullopt`.

Change `AnalyzeSectionSubscripts` to analyze all of the subscripts
even if one has an error. This ensures they all get analyzed expressions
(or `nullopt` in case of error).

Fix a bug analyzing `BoundsRemapping`: the lower bound was analyzed
twice and the upper bound not at all.

These change mean that `typedExpr` is set in all known cases.
Fixes flang-compiler/f18#915.

Original-commit: flang-compiler/f18@679ef69905e39f39454768264059afd85b615840
Reviewed-on: https://github.com/flang-compiler/f18/pull/923
flang/lib/semantics/expression.cc
flang/lib/semantics/expression.h
flang/test/semantics/call13.f90