Problem with norm2 function for complex arrays

Hello

There is an issue with the norm2 function when attempting to calculate the norm of the real and imaginary parts of a complex array. Here is a simple example illustrating the problem:

program test_norm2

implicit none

complex, dimension(2) :: a
real,    dimension(2) :: a_re, a_im

! does not work
! print *, norm2(a%re)
! print *, norm2(a%im)

! copy real and imaginary parts to new arrays
a_re = a%re
a_im = a%im

! works
print *, norm2(a_re)
print *, norm2(a_im)
end program test_norm2
nvfortran 23.11-0 64-bit target on x86-64 Linux -tp haswell 
NVIDIA Compilers and Tools
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.

NVFORTRAN-S-0074-Illegal number or type of arguments to norm2 - keyword argument x (test_norm2.f90: 9)
NVFORTRAN-S-0074-Illegal number or type of arguments to norm2 - keyword argument x (test_norm2.f90: 10)
  0 inform,   0 warnings,   2 severes, 0 fatal for test_norm2

Thanks
Ali

Hi Ali,

Apologies, somehow I missed your post after I got back from vacation on Tuesday.

I reported the issue as TPR#34970 and sent it engineering for review.

Thanks,
Mat

1 Like

Hi Mat,

No problem! Thank you for your reply.

Best,
Ali