NVHPC creates broken code [pepc-v]
Summary
Compiling w/ NVHPC does work (if not too many options for inlining are enabled...) but creates code that will produce wrong results for pepc-v
. The current source code uses a very compact notation that leads to uninitialised variables w/ NVHPC. Lines like
scalar = sum( (/ (sum( (/ (array(i1,i2)*i1, i1=1,3) /) )*i2, i2=1,3) /) )
have i2
uninitialised for the inner summation.
Steps to reproduce
Compile with -C
and run
program test
implicit none
integer :: i1, i2
real :: array(3,3), scalar
call random_number(array)
scalar = sum( (/ (sum( (/ (array(i1,i2)*i1, i1=1,3) /) )*i2, i2=1,3) /) )
write(*,*) scalar
end program test
What is the current bug behaviour?
0: Subscript out of range for array array (sum_test.f90: 8)
subscript=0, lower bound=1, upper bound=3, dimension=2
Possible fixes
Bug and MWE passed on to NVidia.