[flang] Fix .mod file bug with IMPORT of USEd name
authorTim Keith <tkeith@nvidia.com>
Thu, 22 Aug 2019 20:57:18 +0000 (13:57 -0700)
committerTim Keith <tkeith@nvidia.com>
Fri, 23 Aug 2019 14:14:55 +0000 (07:14 -0700)
commit5e65aaa921f18cb3d9ff3ac11dc0a568f5e3d10e
tree8da8c3993a92d0d5ee0ef5c7a0607a8fdbddad59
parent191a5e34b0678bdb587d39658beb9432ef97c969
[flang] Fix .mod file bug with IMPORT of USEd name

If a symbol (derived type, for example) was use-associated into a scope
and then imported into a nested interface block, we were not including
the correct IMPORT statement in the .mod file.

This fixes refines the test for when the IMPORT is needed.

Fixes flang-compiler/f18#657.

Original-commit: flang-compiler/f18@8383de47ecb1b6901e2dd6f290df28fe8a470908
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
flang/lib/semantics/mod-file.cc
flang/test/semantics/modfile23.f90