Message ID | CAKwh3qjvAeNZfxALiXr5FLz4+8EJh3PVVm3d5rakP=OfWk4AQA@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 05/08/2017 02:16 PM, Janus Weil wrote: > Hi all, > > the attached patch fixes an ICE-on-valid problem with finalization by > making sure that the finalization procedures are properly resolved. > > In the test case, the finalizer of the component type was not being > resolved if the superordinate type had a finalizer itself. > > The patch also fixes a small error that had no actual impact on the > test case ('has_final2' could never become true). > > Regtesting went well, except for these three failure which also seems > to occur on a clean trunk currently: > > FAIL: gfortran.dg/coarray_lock_7.f90 -O scan-tree-dump-times original > FAIL: gfortran.dg/coarray_lock_7.f90 -O scan-tree-dump-times original > FAIL: gfortran.dg/mvbits_7.f90 -O0 (test for warnings, line 28) > > Ok for trunk? > > Cheers, > Janus > Yes Ok and thanks for patch. The lock_7 is fixed today and I did not see the mvbits fail yesterday. Regardlessm unrelated. Cheers, Jerry
On Tue, May 09, 2017 at 09:18:42AM -0700, Jerry DeLisle wrote: > > Yes Ok and thanks for patch. The lock_7 is fixed today and I did not see the > mvbits fail yesterday. Regardlessm unrelated. > mvbits_7 is a victim of stupid by non-Fortran committers. /home/sgk/gcc/gccx/gcc/testsuite/gfortran.dg/mvbits_7.f90:28:0: \ Warning: '__builtin_memcpy' reading 192 bytes from a region of \ size 144 [-Wstringop-overflow=] This might be fixed by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80669
2017-05-09 18:18 GMT+02:00 Jerry DeLisle <jvdelisle@charter.net>: > On 05/08/2017 02:16 PM, Janus Weil wrote: >> Hi all, >> >> the attached patch fixes an ICE-on-valid problem with finalization by >> making sure that the finalization procedures are properly resolved. >> >> In the test case, the finalizer of the component type was not being >> resolved if the superordinate type had a finalizer itself. >> >> The patch also fixes a small error that had no actual impact on the >> test case ('has_final2' could never become true). >> >> Regtesting went well, except for these three failure which also seems >> to occur on a clean trunk currently: >> >> FAIL: gfortran.dg/coarray_lock_7.f90 -O scan-tree-dump-times original >> FAIL: gfortran.dg/coarray_lock_7.f90 -O scan-tree-dump-times original >> FAIL: gfortran.dg/mvbits_7.f90 -O0 (test for warnings, line 28) >> >> Ok for trunk? > > Yes Ok and thanks for patch. Thanks, Jerry. Committed as r247818. Cheers, Janus
Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 247757) +++ gcc/fortran/resolve.c (working copy) @@ -12385,26 +12385,23 @@ gfc_resolve_finalizers (gfc_symbol* derived, bool if (parent) gfc_resolve_finalizers (parent, finalizable); - /* Return early when not finalizable. Additionally, ensure that derived-type - components have a their finalizables resolved. */ - if (!derived->f2k_derived || !derived->f2k_derived->finalizers) + /* Ensure that derived-type components have a their finalizers resolved. */ + bool has_final = derived->f2k_derived && derived->f2k_derived->finalizers; + for (c = derived->components; c; c = c->next) + if (c->ts.type == BT_DERIVED + && !c->attr.pointer && !c->attr.proc_pointer && !c->attr.allocatable) + { + bool has_final2 = false; + if (!gfc_resolve_finalizers (c->ts.u.derived, &has_final2)) + return false; /* Error. */ + has_final = has_final || has_final2; + } + /* Return early if not finalizable. */ + if (!has_final) { - bool has_final = false; - for (c = derived->components; c; c = c->next) - if (c->ts.type == BT_DERIVED - && !c->attr.pointer && !c->attr.proc_pointer && !c->attr.allocatable) - { - bool has_final2 = false; - if (!gfc_resolve_finalizers (c->ts.u.derived, &has_final)) - return false; /* Error. */ - has_final = has_final || has_final2; - } - if (!has_final) - { - if (finalizable) - *finalizable = false; - return true; - } + if (finalizable) + *finalizable = false; + return true; } /* Walk over the list of finalizer-procedures, check them, and if any one