This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/48462] [4.6/4.7 Regression] realloc on assignment: matmul Segmentation Fault with Allocatable Array
- From: "pcpa at mandriva dot com.br" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 17 Apr 2011 17:55:21 +0000
- Subject: [Bug fortran/48462] [4.6/4.7 Regression] realloc on assignment: matmul Segmentation Fault with Allocatable Array
- Auto-submitted: auto-generated
- References: <bug-48462-4@http.gcc.gnu.org/bugzilla/>
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.