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/20541] TR 15581: ALLOCATABLE components



------- Comment #12 from paul dot richard dot thomas at cea dot fr  2006-07-18 14:35 -------
Created an attachment (id=11910)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11910&action=view)
The latest version of the patch

This patch is the last version that I will post until after I return from
vacation.  As well as allocatable components, it fixes the two issues raised by
Salvatore Filippone on the gfortran list.  It also includes a test version of
move_alloc that runs the following correctly:

  integer, allocatable :: x(:), y(:), temp(:)
  character(4), allocatable :: a(:), b(:)
  allocate (x(2))
  allocate (a(2))

  x = (/42, 77/)

  print *, allocated(x), allocated(y)
  if (allocated (x)) print *, x
  call move_alloc (x, y)
  print *, allocated(x), allocated(y)
  if (allocated (y)) print *, y


  a = (/"abcd", "efgh"/)
  print *, allocated(a), allocated(b)
  if (allocated (a)) print *, a
  call move_alloc (a, b)
  print *, allocated(a), allocated(b)
  if (allocated (b)) print *, b

! Now one of the intended applications of move_alloc; resizing

  call move_alloc (to = temp, from = y)
  allocate (y(6))
  y(1:2) = temp
  y(3:) = 99
  print *, y
end


Paul 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20541


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