https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61831
--- Comment #44 from Mikael Morin <mikael at gcc dot gnu.org> --- Created attachment 34942 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34942&action=edit Better patch I'm not working on this, so I'm attaching the current patch in my work tree, before it's lost. If I remember correctly, the patch passes the testsuite without regressing. The test in comment #41 exhibits some leaks with it though. And I haven't looked yet at Dominique's feedback in comment #43. Oh, and I have to double check that the gfc_trans_subarray_assign hunk is really necessary.