Bug in accelerator implementation of Fortran abs() intrinsic


PGI Fortran 10.9-0 implementation of the Fortran abs() intrinsic contains a rather embarassing bug for complex arguments. Namely, it is implemented internally as:

complex(8) :: value
real(8) :: result

result = hypot(value,value)

… which in fact is equivalent to:

result = sqrt(2d0) * abs(real(value,kind=8))

Obviously, this is not the intended result. The correct implementation would be:

result = hypot(real(value,kind=8),aimag(value))

This kind of implementation error should have been picked up by the most rudimentary test set.

Since complex math is rather important for my applications, could anybody enlighten me exactly what does and does not get tested for Fortran instrinsic implementation in Fortran CUDA code generator/run-time library?