https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61968
--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Hmm... some analysis. This is a strange piece of code...
interface
subroutine test_lib (a, len) bind(C, name="test")
use iso_c_binding, only: c_size_t
!GCC$ ATTRIBUTES NO_ARG_CHECK :: a
type(*), dimension(*) :: a
OK, so type(*) in a C binding just means a void * pointer on
the C side. But that does not matter: If the BIND(C) is removed,
the assembly failure still happens.
The failure does _not_ happen with
interface test
procedure :: test_32
! procedure :: test_array
end interface test
And if we replace the call to the generic "test" with
a call to the non-generic test_32, all is well.
With the following diff
--- pr1.f90 2019-05-01 22:05:46.317369154 +0200
+++ pr2.f90 2019-05-01 22:05:42.829339353 +0200
@@ -36,5 +36,5 @@
use testmod
type(*), dimension(*) :: a
integer(c_int32_t), value :: len
- call test (a, len)
+ call test_32 (a, len)
end subroutine
between two files (pr1 calls the generic function, pr2 the
non-generic one) we get the following diff in the dumps:
--- pr1.dump 2019-05-01 22:06:07.257548088 +0200
+++ pr2.dump 2019-05-01 22:06:14.577610648 +0200
@@ -137,24 +137,10 @@
symtree: '__iso_c_binding'|| symbol: '__iso_c_binding'
type spec : (UNKNOWN 0)
attributes: (MODULE INTRINSIC)
- symtree: '__vtab_TYPE(*)_0_'|| symbol: '__vtab_TYPE(*)_0_'
- type spec : (DERIVED __vtype_TYPE(*)_0_)
- attributes: (VARIABLE PUBLIC IMPLICIT-SAVE TARGET)
- value: __vtype_TYPE(*)_0_(49723565 , 8_8 , NULL() , NULL() ,
__copy_TYPE(*)_0_:__copy_TYPE(*)_0_ , NULL())
symtree: '__vtab__STAR'|| symbol: '__vtab__STAR'
type spec : (DERIVED __vtype__STAR)
attributes: (VARIABLE IMPLICIT-SAVE TARGET USE-ASSOC(testmod))
value: __vtype__STAR(0 , () , () , () , () , NULL() , ())
- symtree: '__vtype_TYPE(*)_0_'|| symbol: '__vtype_TYPE(*)_0_'
- type spec : (UNKNOWN 0)
- attributes: (DERIVED PUBLIC )
- components:
- (_hash (INTEGER 4) () PRIVATE)
- (_size (INTEGER 8) () PRIVATE)
- (_extends (VOID 0) POINTER () PRIVATE)
- (_def_init (VOID 0) POINTER () PRIVATE)
- (_copy (UNKNOWN 0) PPC () PRIVATE)
- (_final (UNKNOWN 0) PPC () PRIVATE)
symtree: '__vtype__STAR'|| symbol: '__vtype__STAR'
type spec : (UNKNOWN 0)
attributes: (DERIVED USE-ASSOC(testmod))
@@ -212,23 +198,5 @@
code:
CALL test_32 ((test_32_:a(FULL)) (test_32_:len))
-CONTAINS
-
- Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
- procedure name = __copy_TYPE(*)_0_
- symtree: '__copy_TYPE(*)_0_'|| symbol: '__copy_TYPE(*)_0_'
- type spec : (UNKNOWN 0)
- attributes: (PROCEDURE SUBROUTINE ELEMENTAL PURE)
- Formal arglist: src dst
- symtree: 'dst' || symbol: 'dst'
- type spec : (TYPE(*))
- attributes: (VARIABLE DUMMY(INOUT))
- symtree: 'src' || symbol: 'src'
- type spec : (TYPE(*))
- attributes: (VARIABLE DUMMY(IN))
-
- code:
- ASSIGN __copy_TYPE(*)_0_:dst __copy_TYPE(*)_0_:src
-
so there is indeed a bogus vtab being generated somewhere and
somehow.