https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106576
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org Last reconfirmed| |2022-08-13 Status|UNCONFIRMED |ASSIGNED --- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Created attachment 53451 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53451&action=edit Concept patch to show where stuff can be added (finding the cases only) Here's a raw concept patch which shows (via fprintf) where the work could be done. The idea is to look at the statement (and nothing else) and then create a finalization block around it if there is something to finalize. When creating the temporary with gfc_create_var, it probably would make sense to add it to the symbols of the block as well and add it to the routines to be finalized. How does that sound?