gfxgfx
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
logo
 
gfx gfx
gfx
847 Posts in 273 Topics by 2533 Members - Latest Member: pabloosbor September 10, 2010, 05:54:24 PM
*
gfx*HomeHelpSearchLoginRegistergfx
gfxgfx
      « previous next »
Pages: [1] Print
Author Topic: Bug in Absoft 11.0 related to allocatable components of derived types  (Read 981 times)
mecej4
Newbie
*
Posts: 15


View Profile
« on: March 04, 2010, 03:11:40 AM »

The distilled program

Code:
  program tst
  implicit none
!
  integer, parameter :: k_wp = kind(1.d0)
  type :: sta
     integer :: n
     real(k_wp),pointer :: a(:)
  end type sta
  type(sta), allocatable :: zd(:),zu(:)
!
  allocate(zd(1))
  zd(1)%n = 2
  allocate(zd(1)%a(zd(1)%n))
!
  allocate(zu(1))
  zu(1)%n = 4
  allocate(zu(1)%a(zu(1)%n))
!
  zd(1)%a = (/ -4d0,-3d0 /)
  zu(1)%a = (/ 1d0,2d0,3d0,4d0 /)
  call sub(zd,zu)

  deallocate(zd(1)%a, zu(1)%a)
  deallocate(zd, zu)

  contains

  subroutine sub(zd,zu)
  type(sta) :: zd(:),zu(:)
  real(k_wp) :: z(zd(1)%n + zu(1)%n)
  character(len = 20),save :: fmt='(1x,A6,1p,6D13.4)'

  z = (/ zd(1)%a , zu(1)%a /)
  write(*,fmt)' zd = ',zd(1)%a
  write(*,fmt)' zu = ',zu(1)%a
  write(*,fmt)' z  = ',z
  return
  end subroutine sub

  end program tst

produces the erroneous output

Code:
  zd =   -4.0000D+00  -3.0000D+00
  zu =    1.0000D+00   2.0000D+00   3.0000D+00   4.0000D+00
  z  =    0.0000D+00   0.0000D+00   0.0000D+00   0.0000D+00   0.0000D+00   0.0000D+00

instead of the correct result

Code:
  zd =   -4.0000D+00  -3.0000D+00
  zu =    1.0000D+00   2.0000D+00   3.0000D+00   4.0000D+00
  z  =   -4.0000D+00  -3.0000D+00   1.0000D+00   2.0000D+00   3.0000D+00   4.0000D+00

The compiler default options were used (f95 tst.f90).
« Last Edit: March 04, 2010, 03:21:48 AM by mecej4 » Logged
forumadmin
Administrator
Full Member
*****
Posts: 131


View Profile Email
« Reply #1 on: March 04, 2010, 09:55:20 AM »

Our support team was able to duplicate the incorrect results using Absoft 11.0.0. However, the results when compiled
with the latest service pack (11.0.2) match your expected results.

$ f95
Absoft 64-bit Fortran 95 11.0.2

$ f95 tst.f90
$ ./a.out
  zd =   -4.0000D+00  -3.0000D+00
  zu =    1.0000D+00   2.0000D+00   3.0000D+00   4.0000D+00
  z  =   -4.0000D+00  -3.0000D+00   1.0000D+00   2.0000D+00   3.0000D+00   4.0000D+00


You can obtain the 11.0.2 service pack here:

http://www.absoft.com/download/downloads.html


Logged
gfx
Pages: [1] Print 
gfx
Jump to:  
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!