Created
February 8, 2012 00:08
-
-
Save alanbriolat/1763237 to your computer and use it in GitHub Desktop.
gfortran matrix multiplication result size bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program foo | |
real, parameter :: A(2, 3) = reshape((/ 0, 0, 0, 0, 0, 0 /), (/ 2, 3 /)) | |
real, parameter :: B(2) = (/ 0, 0 /) | |
real, parameter :: C(3) = matmul(B, A) | |
! 1 | |
!Error: Different shape for array assignment at (1) on dimension 1 (3 and 2) | |
!f951: internal compiler error: in gfc_simplify_reshape, at fortran/simplify.c:5104 | |
! This works in some versions of gfortran: | |
real, parameter :: D(3) = reshape(matmul(B, A), (/ 3 /)) | |
! Others give: | |
!f951: internal compiler error: in gfc_simplify_reshape, at fortran/simplify.c:5104 | |
! This outputs 3 values: | |
print *, matmul(B, A) | |
end program foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment