[Bug fortran/45183] [4.6 Regression] FAIL: gfortran.dg/derived_constructor_char_1.f90
--- Comment #1 from burnus at gcc dot gnu dot org 2010-08-04 17:39 --- PATCH - lightly tested. Now regtesting. Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (Revision 162868) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -936,11 +936,26 @@ resolve_structure_cons (gfc_expr *expr) p = gfc_constructor_first (cons-expr-value.constructor); if (cons-expr-ts.u.cl != p-expr-ts.u.cl) { - gfc_free_expr (cons-expr-ts.u.cl-length); - gfc_free (cons-expr-ts.u.cl); + gfc_charlen *cl, *cl2; + + cl2 = NULL; + for (cl = gfc_current_ns-cl_list; cl; cl = cl-next) + { + if (cl == cons-expr-ts.u.cl) + break; + cl2 = cl; + } + + gcc_assert (cl); + + if (cl2) + cl2-next = cl-next; + + gfc_free_expr (cl-length); + gfc_free (cl); } - cons-expr-ts.u.cl = gfc_get_charlen (); + cons-expr-ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL); cons-expr-ts.u.cl-length_from_typespec = true; cons-expr-ts.u.cl-length = gfc_copy_expr (comp-ts.u.cl-length); gfc_resolve_character_array_constructor (cons-expr); -- burnus at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-08-04 17:39:41 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45183
[Bug fortran/45183] [4.6 Regression] FAIL: gfortran.dg/derived_constructor_char_1.f90
--- Comment #2 from kargl at gcc dot gnu dot org 2010-08-04 18:09 --- (In reply to comment #1) PATCH - lightly tested. Now regtesting. Index: gcc/fortran/resolve.c === --- gcc/fortran/resolve.c (Revision 162868) +++ gcc/fortran/resolve.c (Arbeitskopie) @@ -936,11 +936,26 @@ resolve_structure_cons (gfc_expr *expr) p = gfc_constructor_first (cons-expr-value.constructor); if (cons-expr-ts.u.cl != p-expr-ts.u.cl) { - gfc_free_expr (cons-expr-ts.u.cl-length); - gfc_free (cons-expr-ts.u.cl); + gfc_charlen *cl, *cl2; + + cl2 = NULL; + for (cl = gfc_current_ns-cl_list; cl; cl = cl-next) + { + if (cl == cons-expr-ts.u.cl) + break; + cl2 = cl; + } + + gcc_assert (cl); + + if (cl2) + cl2-next = cl-next; + + gfc_free_expr (cl-length); + gfc_free (cl); } - cons-expr-ts.u.cl = gfc_get_charlen (); + cons-expr-ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL); cons-expr-ts.u.cl-length_from_typespec = true; cons-expr-ts.u.cl-length = gfc_copy_expr (comp-ts.u.cl-length); gfc_resolve_character_array_constructor (cons-expr); I must be missing something here. What does cl2 do in the above patch? You set it, but it is never used. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45183
[Bug fortran/45183] [4.6 Regression] FAIL: gfortran.dg/derived_constructor_char_1.f90
--- Comment #3 from kargl at gcc dot gnu dot org 2010-08-04 18:13 --- I must be missing something here. What does cl2 do in the above patch? You set it, but it is never used. Nevermind, I understand what the code does. I can't even claim that I haven't had enough coffee this morning. :( -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45183
[Bug fortran/45183] [4.6 Regression] FAIL: gfortran.dg/derived_constructor_char_1.f90
--- Comment #4 from burnus at gcc dot gnu dot org 2010-08-04 18:49 --- Subject: Bug 45183 Author: burnus Date: Wed Aug 4 18:49:23 2010 New Revision: 162871 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=162871 Log: 2010-08-04 Tobias Burnus bur...@net-b.de PR fortran/45183 PR fortran/44857 * resolve.c (resolve_structure_cons): Fix freeing of charlen. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45183
[Bug fortran/45183] [4.6 Regression] FAIL: gfortran.dg/derived_constructor_char_1.f90
--- Comment #5 from burnus at gcc dot gnu dot org 2010-08-04 18:50 --- FIXED. Thanks for the timely report. -- burnus at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45183