Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28865 Discussions

Missing diagnostic for passing NULL() without MOLD to assumed-rank dummy

Harald1
New Contributor II
159 Views

Hello,

the following code is properly diagnosed by NAG but accepted without warning by ifx-2025.0:

program p
  implicit none
  integer, pointer :: a, a3(:,:,:)
  call foo (a)
  call foo (null (a))
  call foo (a3)
  call foo (null (a3))
  call foo (null())  ! NAG: MOLD argument is missing / not detected by ifx
contains
  subroutine foo(x)
    integer, pointer, intent(in) :: x(..)
    print *, rank(x)
  end subroutine
end

 NAG prints:

% nagfor ifx-null-actual.f90 
NAG Fortran Compiler Release 7.2(Shin-Urayasu) Build 7200
Error: ifx-null-actual.f90, line 8: Argument X (no. 1) to FOO is intrinsic NULL with no MOLD argument, but X is assumed-rank
[NAG Fortran Compiler error termination, 1 error]

 ifx however accepts the code:

% ifx ifx-null-actual.f90 -stand && ./a.out
           0
           0
           3
           3
           1

 It is funny that NULL() should have a well-defined rank ...

Thanks,

Harald

 

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
122 Views

NAG has implemented a check for interpretation F18/041, Intel has not yet.  (Note who submitted this!) It was accepted as part of F2018 Corrigendum 2. 

0 Kudos
Reply