This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/48462] [4.6/4.7 Regression] realloc on assignment: matmul Segmentation Fault with Allocatable Array


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]