You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flang] Refine handling of NULL() actual to non-optional allocatable … (#116126)
…dummy
We presently allow a NULL() actual argument to associate with a
non-optional dummy allocatable argument only under INTENT(IN). This is
too strict, as it precludes the case of a dummy argument with default
intent. Continue to require that the actual argument be definable under
INTENT(OUT) and INTENT(IN OUT), and (contra XLF) interpret NULL() as
being an expression, not a definable variable, even when it is given an
allocatable MOLD.
Fixes#115984.
! Catch NULL() actual argument association with allocatable dummy argument
3
3
program test
4
-
!ERROR: NULL() actual argument 'NULL()' may not be associated with allocatable dummy argument 'a=' without INTENT(IN)
4
+
real, allocatable:: a
5
+
!ERROR: NULL() actual argument 'NULL()' may not be associated with allocatable dummy argument dummy argument 'a=' that is INTENT(OUT) or INTENT(IN OUT)
6
+
call foo0(null())
7
+
!WARNING: NULL() actual argument 'NULL()' should not be associated with allocatable dummy argument dummy argument 'a=' without INTENT(IN)
5
8
call foo1(null())
6
9
!PORTABILITY: Allocatable dummy argument 'a=' is associated with NULL()
7
10
call foo2(null())
8
11
call foo3(null()) ! ok
12
+
!ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'a=' is not definable
13
+
!BECAUSE: 'null(mold=a)' is a null pointer
14
+
call foo0(null(mold=a))
15
+
!WARNING: A null pointer should not be associated with allocatable dummy argument 'a=' without INTENT(IN)
16
+
call foo1(null(mold=a))
17
+
!PORTABILITY: Allocatable dummy argument 'a=' is associated with a null pointer
0 commit comments