https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109
--- Comment #22 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Thomas Koenig from comment #21) > As for a workaround for memory leaks, you can always add > > if (.not. allocated(a)) deallocate (a) Of course, that should be if (allocated(a)) deallocate(a) Value propagation and dead code removal are good enough that a sequence of such statements will be merged into a single one.