This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/64209] [OOP] runtime segfault with CLASS(*), INTENT(OUT) dummy argument
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Dec 2014 23:24:41 +0000
- Subject: [Bug fortran/64209] [OOP] runtime segfault with CLASS(*), INTENT(OUT) dummy argument
- Auto-submitted: auto-generated
- References: <bug-64209-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64209
--- Comment #6 from janus at gcc dot gnu.org ---
Here is a reduced test case for the remaining segfault:
PROGRAM main
IMPLICIT NONE
INTEGER :: copy_x(3)
CALL copy(1,copy_x)
PRINT *, copy_x
CONTAINS
SUBROUTINE copy(x,a)
integer, INTENT(IN) :: x
CLASS(*), INTENT(OUT) :: a(:)
SELECT TYPE(a); TYPE IS(integer)
a(:) = x
END SELECT
END SUBROUTINE
END PROGRAM
It's a very similar scheme as in comment #2, only this time we have an
array-valued CLASS(*), INTENT(OUT) argument.
I think the problem is with _def_init being NULL again. For the array case here
the dump shown a line like:
a->_vptr->_copy (a->_vptr->_def_init, &a->_data);
Again we need a conditional check for _def_init being non-NULL.