Silverfrost Forums

Welcome to our forums

Problem with transfer function

5 Dec 2005 6:48 #474

I am experiencing crashes and strange results when using the transfer function. I have reduced my program to a small test case: [pre] module trf

integer,parameter:: rkind=selected_real_kind(p=5)
integer,parameter:: msize=10

real(kind=rkind), dimension(:,:), allocatable:: mat

contains

subroutine test_transfer()
    implicit none
    real(kind=rkind), allocatable   :: vec(:)
    integer                        :: i, j, err

    print *, 'Allocate mat'
    allocate(mat(msize,msize))

    print *, 'Fill mat'
    do i = 1,msize
        do j=1,msize
            mat(i,j) = real(i+j)
        end do
    end do

    print *, 'Allocate vec, size=',size(mat)
    allocate(vec(size(mat)), stat=err)

    print *, 'Transfer mat => vec'
    vec = transfer(mat,vec)

    print *,'Vec(1):',vec(1)
    print *,'Vec(last):',vec(size(mat))

end subroutine test_transfer

end module trf

program main use trf

call test_transfer

end program main [/pre]

  • when I run the program as shown, it works, but for the last element of vec it prints 0.000 while it should be 20.0
  • when I increase the size of the arrays either the program does never terminate (actually I killed it after 5 minutes) or I get the following message: [pre] Runtime error from program:c:\temp\dev\f95\bugs\transfer_3.exe Access Violation The instruction at address 004014bc attempted to read from location 0383e000 in file transfer_3.f90 at line 29

TRF!TEST_TRANSFER - in file transfer_3.f90 at line 29 [+04bc]

main - in file transfer_3.f90 at line 40 [+0031]

eax=000f4240 ebx=003d0900 ecx=001a2548 edx=00000001 esi=0383e000 edi=0a64ecc8 ebp=0360fcf8 esp=02e6ea10 IOPL=1 ds=0023 es=0023 fs=003b gs=0000 cs=001b ss=0023 flgs=00010206 [NC EP NZ SN DN NV]

004014bc rep
004014bd movsb
004014be mov eax,[ebp-0x9c] [/pre] This is with a size of 1000 and /CHECKMATE

The message changes slightly with different options ( i tried /DEBUG and /UNDEF and /OPTIMISE)

Johny

5 Dec 2005 1:06 #475

Johny

We will look into this for you as soon as possible.

Paul

20 Apr 2006 12:38 #641

This bug has now been fixed for the next release.

Please login to reply.