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.
Note 1: The added intent field is useless for all intrinsic
functions since none of them have intent out/inout arguments (I think,
but did not thoroughly checked). Since the table is not that small, the
change leads in a ~10ko increase in intrinsics.cpp.o (RL mode, gcc 8.3).
Since we are talking a bout a 0.03% space increase and that I am not sure how true
it is that all intrinsic functions will always have intent in arguments,
I ruled that this was OK.
Note 2: For the C846 fix, I considered adding an "Intrinsic" attribute
to characteristics::Procedure Attr, it worked but then seemed like a
bad idea to me since we would think that we are in an intrinsic call
when calling bar in the program below since characteristic built from
an intrinsic name can be used for user procedure.
subroutine foo(bar) procedure(acos) bar y = bar(x) end subroutine