LI77525: INCORRECT OUTPUT FROM LIBMASS
A fix is available
Closed as program error.
The following Fortran program gives out incorrect result for the imaginary part if compiled with xlf. xlf90 -o f_mass testmass.f90 -lmass ** test === End of Compilation 1 === 1501-510 Compilation successful for file testmass.f90. -bash-4.1$ ./f_mass baseline 0.707372016677029064E-01 0.997494986604054446 cmplx1 -0.499791196558983131 0.354839677501255478E-03 cmplx2 -0.499791196558983131 0.354839677501255478E-03 sn, cs 0.997494986604054446 0.707372016677029064E-01 cat testmass.f90 program test use, intrinsic :: iso_c_binding implicit none include 'mass.include' real(c_double) :: ThreeHalf = 1.5d0 real(c_double), target :: sn, cs complex(c_double_complex) :: cmplx1, cmplx2 cmplx1 = cmplx(-111,-222) cmplx2 = cmplx1 sn = -111 cs = -222 write(*,*) " baseline ", cos(ThreeHalf), " ", sin(ThreeHalf) cmplx1 = cosisin(ThreeHalf) write(*,*) " cmplx1 ", real(cmplx1), " ", aimag(cmplx1) cmplx2 = cosisin(1.5d0) write(*,*) " cmplx2 ", real(cmplx2), " ", aimag(cmplx2) call sincos(ThreeHalf, sn, cs); write(*,*) " sn, cs ", sn, " ", cs end program test
PROBLEM DESCRIPTION: MASS cosisin function does not work correctly when called from Fortran due to linkage mismatch. USERS AFFECTED: Fortran calls to MASS cosisin on Linux or BG/Q-LoP in 32-bit mode.
Linux and BG/Q-LoP MASS cosisin is compiled with xlc and default option -qcomplexgcc. This causes it to return the complex result in GPRs(General Purpose Registers) rather than FPRs (Floating Point Registers) for 32-bit mode. xlf by default uses -qnocomplexgcc, which expects complex results in FPRs. In order to make the xlf linkage compatible with MASS, without breaking MASS compatibility with xlc, we changed the xlf Front End to turn cosisin into a BIF, and removed the cosisin prototype from mass.include.
Reported component name
XL FORTRAN LINU
Reported component ID
Last modified date
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fixed component name
XL FORTRAN LINU
Fixed component ID
Applicable component levels
Translate this page: