diff options
author | Janus Weil <janus@gcc.gnu.org> | 2016-12-09 14:21:44 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2016-12-09 14:21:44 +0100 |
commit | cdeb16cbf2c388432fa4672d37d87ee55878de13 (patch) | |
tree | 8a5afc874e5edc2be1ea501e48bda1f67620b5e8 /gcc/fortran/class.c | |
parent | ffaf9305aa0f0d4a4cc6cc8afa5444b94b2b67a0 (diff) | |
download | gcc-cdeb16cbf2c388432fa4672d37d87ee55878de13.zip gcc-cdeb16cbf2c388432fa4672d37d87ee55878de13.tar.gz gcc-cdeb16cbf2c388432fa4672d37d87ee55878de13.tar.bz2 |
re PR fortran/61767 ([OOP] ICE in generate_finalization_wrapper at fortran/class.c:1491)
2016-12-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/61767
* class.c (has_finalizer_component): Fix this function to detect only
non-pointer non-allocatable components which have a finalizer.
2016-12-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/61767
* gfortran.dg/finalize_31.f90: New test.
From-SVN: r243483
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r-- | gcc/fortran/class.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index e59b87c..1fba6c9 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -841,20 +841,19 @@ has_finalizer_component (gfc_symbol *derived) gfc_component *c; for (c = derived->components; c; c = c->next) - { - if (c->ts.type == BT_DERIVED && c->ts.u.derived->f2k_derived - && c->ts.u.derived->f2k_derived->finalizers) - return true; - - /* Stop infinite recursion through this function by inhibiting - calls when the derived type and that of the component are - the same. */ - if (c->ts.type == BT_DERIVED - && !gfc_compare_derived_types (derived, c->ts.u.derived) - && !c->attr.pointer && !c->attr.allocatable - && has_finalizer_component (c->ts.u.derived)) - return true; - } + if (c->ts.type == BT_DERIVED && !c->attr.pointer && !c->attr.allocatable) + { + if (c->ts.u.derived->f2k_derived + && c->ts.u.derived->f2k_derived->finalizers) + return true; + + /* Stop infinite recursion through this function by inhibiting + calls when the derived type and that of the component are + the same. */ + if (!gfc_compare_derived_types (derived, c->ts.u.derived) + && has_finalizer_component (c->ts.u.derived)) + return true; + } return false; } |