[flang] Document and use intrinsic subroutine argument intents
authorJean Perier <jperier@nvidia.com>
Tue, 20 Oct 2020 10:39:26 +0000 (12:39 +0200)
committerJean Perier <jperier@nvidia.com>
Tue, 20 Oct 2020 12:09:46 +0000 (14:09 +0200)
commit29d1a494477d78f9c86564b851891702456ddffb
tree08f33df443739c5b6e59c3e24d88cad0e0ebc081
parentc0cdd22c72fab47a3c37b5a8401763995cadaa77
[flang] Document and use intrinsic subroutine argument intents

Check INTENT(OUT)/INTENT(INOUT) constraints for actual argument
of intrinsic procedure calls.
- Adding a common::Intent field to the IntrinsicDummyArgument
in the intrinsic table.
- Propagating it to the DummyDataObject intent field so that it can
later be used in CheckExplicitDataArg semantic checks.
- Add related tests.
- Fix regression (C846 false error), C846 INTENT(OUT) rule does
  not apply to intrinsic call. Propagate the information that we
  are in an intrinsic call up to CheckExplicitDataArg (that is
  doing this check). Still enforce C846 on intrinsics other than MOVE_ALLOC (for which
  allocatable coarrays are explicitly allowed) since it's not clear it is allowed in all
  intrinsics and allowing this would lead to runtime penalties in the intrinsic runtime.

Differential Revision: https://reviews.llvm.org/D89473
flang/include/flang/Evaluate/characteristics.h
flang/include/flang/Evaluate/intrinsics.h
flang/lib/Evaluate/characteristics.cpp
flang/lib/Evaluate/intrinsics.cpp
flang/lib/Semantics/check-call.cpp
flang/lib/Semantics/check-call.h
flang/lib/Semantics/expression.cpp
flang/test/Semantics/call03.f90