Re: [PATCH] fortran: [PR47425] Array constructor fails with length type expr
Jerry D <[email protected]>
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:31f66a843429269ee9cdc6ce69ba3ff698773a35 commit r17-3155-g31f66a843429269ee9cdc6ce69ba3ff698773a35 Author: Jerry DeLisle <[email protected]> Date: Sat Aug 8 08:59:16 2026 -0700 fortran: [PR47425] Array constructor fails with length type expr Has promised over a month ago and almost forgotten. On 7/4/26 9:55 AM, Jerry D wrote: > No comments, so I plan to commit this on July 6 after the weekend activities. > > On 7/2/26 8:32 AM, Jerry D wrote: >> ping >> >> On 7/1/26 10:15 AM, Jerry D wrote: >>> See attached patch. >>> >>> Regression tested on x86_64. Two new test cases added. >>> >>> This one was from a long time ago. >>> >>> OK for mainline? >>> >>> Regards, >>> >>> Jerry >>> --- >>> fortran: [PR47425] Array constructor fails with length type expr >>> >>> Two separate problems are fixed here. The original test case is fixed >>> by the one-liner in trans-array.cc. Add check for INTEGER_CST. The >>> remaining problem starts with parsing and not keeping track of charlens >>> where some of the charlens are created and later left dangling. Code was >>> added to keep track of these and remove them as needed. >>> >>> PR fortran/47425 >>> >>> gcc/fortran/ChangeLog: >>> >>> * decl.cc (discard_pending_charlen): Use new helper >>> function. >>> (discard_pending_charlens): Likewise. >>> (build_struct): Likewise. >>> * gfortran.h (struct gfc_charlen): Add a namespace >>> pointer to track char len for undo. >>> (struct gfc_undo_change_set): Add cls >>> pointer to track charlens created during parsing. >>> (struct gfc_undo_change_set): Add vec<gfc_charlen *> cls. >>> (gfc_remove_saved_charlen): Declare new helper function. >>> * parse.cc (accept_statement): Adjust comment. >>> * symbol.cc (gfc_merge_new_implicit): Use new helper function >>> (free_undo_change_set_data): Release cls. >>> (gfc_drop_last_undo_checkpoint): Splice cls into parent >>> changeset. >>> (gfc_restore_last_undo_checkpoint): Remove and free charlens >>> tracked in cls. >>> (gfc_commit_symbols): Truncate cls. >>> (gfc_remove_saved_charlen): New function to remove >>> previously saved char len. >>> (gfc_free_namespace): Remove charlens from undo before freeing >>> to prevent double-free. >>> (gfc_enforce_clean_symbol_state): Clear cls instead of asserting >>> empty; non-tentative callers leave charlens in cls. >>> * trans-array.cc (trans_array_constructor): Add guard. >>> >>> gcc/testsuite/ChangeLog: >>> >>> * gfortran.dg/pr47425-1.f90: New test. >>> * gfortran.dg/pr47425-2.f90: New test. >>> --- >> >