Hi,
The PGI Fortran compiler v16.3-0 seems to produce strange results with the EXPONENT intrinsic when using the “-i8” flag for 8-byte integers.
The following code highlights the problem:
PROGRAM exponent_test
IMPLICIT NONE
REAL :: fp_number = 1.
PRINT "(A,F,A,I)", "EXPONENT(", fp_number, ")=", EXPONENT(fp_number)
END PROGRAM exponent_test
Compiling and running this produces the following result:
$ pgfortran --version
pgfortran 16.3-0 64-bit target on x86-64 Linux -tp nehalem
The Portland Group - PGI Compilers and Tools
Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
$ pgfortran -o exponent_test.x exponent_test.f90
$ ./exponent_test.x
EXPONENT( 1.0000000)= 1
When I repeat compilation with the “-i8” flag, I get this result:
$ pgfortran -o exponent_test.x -i8 exponent_test.f90
$ ./exponent_test.x
EXPONENT( 1.0000000)= -126
The older version 10.3-0 behaves differently:
$ pgfortran -V
pgfortran 10.3-0 64-bit target on x86-64 Linux -tp nehalem-64
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2010, STMicroelectronics, Inc. All Rights Reserved.
$ pgfortran -o exponent_test.x -i8 exponent_test.f90
$ ./exponent_test.x
EXPONENT( 1.0000000)= 1
Could this be a bug in v16.3?
Thanks!