This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45004] [OOP] Segfault with allocatable scalars and move_alloc
- From: "janus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jul 2010 21:44:54 -0000
- Subject: [Bug fortran/45004] [OOP] Segfault with allocatable scalars and move_alloc
- References: <bug-45004-9410@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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