[Bug fortran/48462] [4.6/4.7 Regression] realloc on assignment: matmul Segmentation Fault with Allocatable Array
pcpa at mandriva dot com.br
gcc-bugzilla@gcc.gnu.org
Sun Apr 17 17:55:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48462
Paulo César Pereira de Andrade <pcpa at mandriva dot com.br> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pcpa at mandriva dot com.br
--- Comment #8 from Paulo César Pereira de Andrade <pcpa at mandriva dot com.br> 2011-04-17 17:54:26 UTC ---
I am using the suggested solution in the Mandriva
gcc-4.6.0 package, to correct a bug report from
an user at
https://qa.mandriva.com/show_bug.cgi?id=63047
with the test case:
-%<-
program segmatmul
implicit none
integer :: i,j
integer :: nsize
real, dimension(:,:), allocatable :: matrixA, matrixB
nsize=10
allocate(matrixA(nsize,nsize),matrixB(nsize,nsize))
do i=1,nsize
do j=1,nsize
matrixA = real(i+j)
matrixB = real(i-j)
enddo
enddo
!segfaults
matrixA = matmul(matmul(transpose(matrixB),matrixA),matrixB)
deallocate(matrixA, matrixB)
end program segmatmul
-%<-
and compiled as:
$ gfortran -g segmatmul.f90 -o segmatmul.bin
that would cause a segfault due to matrixA being an
argument and also output value of the call.
Adding -std=f95 appeared to correct the issue in
the above sample.
More information about the Gcc-bugs
mailing list