[flang] Semantic checks for deallocating entities with IMPURE FINAL procedures
authorPete Steinfeld <psteinfeld@nvidia.com>
Mon, 27 Jan 2020 22:12:35 +0000 (14:12 -0800)
committerPete Steinfeld <psteinfeld@nvidia.com>
Wed, 29 Jan 2020 20:42:52 +0000 (12:42 -0800)
commiteaf2288857242f4502df2e3690a430accc0a2128
tree8f823256613538139d192d3bbabee76f24373367
parent431b0aef135b87d7f26e536af910a4106b3beaca
[flang] Semantic checks for deallocating entities with IMPURE FINAL procedures

You cannot call an IMPURE procedure in a DO CONCURRENT construct.  One
way that can happen is if an entity with an IMPURE FINAL procedure gets
deallocated.  Similar to the checks for deallocating coarrays, there are
three ways that an entity can get deallocated that are applicable to DO
CONCURRENT constructs -- an actual DEALLOCATE statement, block exit, and
assignment.

This change depends on the utility function `HasImpureFinal()` in tools.h to
determine if an entity has a derived type with an IMPURE FINAL
procedure.  In the course of testing this change, I realized that this
check is incorrect, but the code specific to DO CONCURRENT is
independent of the check, so I might as well implement it.

Original-commit: flang-compiler/f18@d2294ff511aebd64889df57d02325bd6fcdf914a
Reviewed-on: https://github.com/flang-compiler/f18/pull/954
flang/include/flang/semantics/tools.h
flang/lib/semantics/check-do.cpp
flang/lib/semantics/tools.cpp
flang/test/semantics/doconcurrent08.f90