diff options
author | Tobias Burnus <burnus@net-b.de> | 2012-12-03 22:13:42 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2012-12-03 22:13:42 +0100 |
commit | 86035eeca65c54f7325fb6edd5839e3b59ad5002 (patch) | |
tree | 8da31991a03b702cbf404d3fe909158f795a90d9 /gcc/fortran/trans-expr.c | |
parent | 0e668eaf774f01c3c8938840576652b0d21ad3ca (diff) | |
download | gcc-86035eeca65c54f7325fb6edd5839e3b59ad5002.zip gcc-86035eeca65c54f7325fb6edd5839e3b59ad5002.tar.gz gcc-86035eeca65c54f7325fb6edd5839e3b59ad5002.tar.bz2 |
re PR fortran/37336 ([F03] Finish derived-type finalization)
2012-12-03 Tobias Burnus <burnus@net-b.de>
Janus Weil <janus@gcc.gnu.org>
PR fortran/37336
* class.c (gfc_is_finalizable): New function.
* gfortran.h (gfc_is_finalizable): Its prototype.
* module.c (mio_component): Read initializer for vtype's _final.
* resolve.c (resolve_fl_derived0): Call gfc_is_finalizable.
* trans-expr.c (gfc_vtable_final_get): New function.
(conv_parent_component_references): Fix comment.
(gfc_conv_variable): Fix for scalar coarray components.
* trans-intrinsic.c (conv_intrinsic_move_alloc): For BT_CLASS,
pass the BT_CLASS type and not the declared type to
gfc_deallocate_scalar_with_status.
* trans.h (gfc_vtable_final_get): New prototype.
Co-Authored-By: Janus Weil <janus@gcc.gnu.org>
From-SVN: r194104
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index d6410d3..42f6e0c 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -95,6 +95,7 @@ conv_scalar_to_descriptor (gfc_se *se, tree scalar, symbol_attribute attr) #define VTABLE_EXTENDS_FIELD 2 #define VTABLE_DEF_INIT_FIELD 3 #define VTABLE_COPY_FIELD 4 +#define VTABLE_FINAL_FIELD 5 tree @@ -180,6 +181,13 @@ gfc_vtable_copy_get (tree decl) } +tree +gfc_vtable_final_get (tree decl) +{ + return gfc_vtable_field_get (decl, VTABLE_FINAL_FIELD); +} + + #undef CLASS_DATA_FIELD #undef CLASS_VPTR_FIELD #undef VTABLE_HASH_FIELD @@ -187,6 +195,7 @@ gfc_vtable_copy_get (tree decl) #undef VTABLE_EXTENDS_FIELD #undef VTABLE_DEF_INIT_FIELD #undef VTABLE_COPY_FIELD +#undef VTABLE_FINAL_FIELD /* Obtain the vptr of the last class reference in an expression. */ @@ -1510,7 +1519,7 @@ conv_parent_component_references (gfc_se * se, gfc_ref * ref) dt = ref->u.c.sym; c = ref->u.c.component; - /* Return if the component is not in the parent type. */ + /* Return if the component is in the parent type. */ for (cmp = dt->components; cmp; cmp = cmp->next) if (strcmp (c->name, cmp->name) == 0) return; @@ -1714,6 +1723,9 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr) conv_parent_component_references (se, ref); gfc_conv_component_ref (se, ref); + if (!ref->next && ref->u.c.sym->attr.codimension + && se->want_pointer && se->descriptor_only) + return; break; |