http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58880
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> --- Draft patch. Janus: As you have a better idea when vtables are generated: Have you an idea why the finalization wrapper__final_gn_Nde is not produced? And how to fix that? --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -71,2 +71,5 @@ gfc_conv_scalar_to_descriptor (gfc_se *se, tree scalar, DECL_ARTIFICIAL (desc) = 1; + + if (!POINTER_TYPE_P (TREE_TYPE (scalar))) + scalar = gfc_build_addr_expr (NULL_TREE, scalar); gfc_add_modify (&se->pre, gfc_conv_descriptor_dtype (desc), @@ -77,4 +80,3 @@ gfc_conv_scalar_to_descriptor (gfc_se *se, tree scalar, if the actual argument is a pointer and not, e.g., NULL(). */ - if ((attr.pointer || attr.allocatable) - && attr.intent != INTENT_IN && POINTER_TYPE_P (TREE_TYPE (scalar))) + if ((attr.pointer || attr.allocatable) && attr.intent != INTENT_IN) gfc_add_modify (&se->post, scalar,