Compiler error PGI Fortran 12.x

Hello,
I found a Compiler error in all PGI Fortran versions 12.x

If I compile the following program:

program matrixtest
implicit none
real(kind = 4),dimension(2,2) :: a,b,h

a(1,1) = 1.0 ; a(1,2) = 2.0
a(2,1) = 3.0 ; a(2,2) = 4.0

b(1,1) = 5.0 ; b(1,2) = 6.0
b(2,1) = 7.0 ; b(2,2) = 8.0

write(,) ‘matmul(a,transpose(b))=’,matmul(a,transpose(b))

h = transpose(b)

write(,) ‘matmul(a,h)=’,matmul(a,h)

end program matrixtest



the results of both write-statements should be obviously the same.

That’s the result of PGI-Fortran 11.3, 11.10:

jost@linux:~> pgf90 matrixtest.f90
jost@linux:~> ./a.out
matmul(a,transpose(b))= 17.00000 39.00000 23.00000
53.00000
matmul(a,h)= 17.00000 39.00000 23.00000 53.00000
jost@linux:~>



And this is the result of PGI-Fortran 12.x (tested with 12.2, 12.3, and 12.4):

jost@linux:~> pgf90 matrixtest.f90
jost@linux:~> ./a.out
matmul(a,transpose(b))= 5.000000 25.00000 5.000000
25.00000
matmul(a,h)= 17.00000 39.00000 23.00000 53.00000
jost@linux:~>

Is it possible to repair the compiler, since matrix calculations are very important for us?

Thanks and regards,
Jost

Hi Jost,

Thanks for the report. I added TPR#18670 and sent it off our engineers for investigation.

I’ll update once I know more.

  • Mat

Hi Jost,

Looks like this is a problem with a new optimization we added for small matmuls. To disable this optimization please add the internal compiler flag “-Hx,47,0x200”.

Best Regards,
Mat

Hi Mat,

thank you very much! It seems to work perfectly with the internal compiler flag!

Best regards,
Jost