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/45004] [OOP] Segfault with allocatable scalars and move_alloc



------- Comment #3 from janus at gcc dot gnu dot org  2010-07-22 21:44 -------
Here is an even more elementary example which shows that there is a problem for
allocatable scalars, already without any polymorphic variables:

  implicit none
  integer, allocatable :: afab1,afab2
  allocate(afab1)
  afab1 = irand()
  print *,afab1
  call move_alloc(afab1, afab2)
  print *,afab2
  print *,allocated(afab2)
  print *,allocated(afab1)
end


This directly segfaults on move_alloc:

       16807
Segmentation fault


The problem is that _gfortran_move_alloc expects two array descriptors as
arguments, but allocatable scalars have none. Therefore we probably need
something like '_gfortran_move_alloc_scalar'.

For classes we will probably have to add a reference to the $data component
before passing them to move_alloc.


-- 


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


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