https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113893
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |ebotcazou at gcc dot gnu.org Summary|Finalization exception |finalization issue with |issue with anonymous access |anonymous access object of |object. |local type Last reconfirmed| |2024-02-14 Ever confirmed|0 |1 --- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- The problem is that the finalization routine of Float_Sanitized.Container is local to Test01 but is invoked indirectly from "its enclosing library unit" when the dynamically allocated object is finalized, namely the enclosing procedure. So it's a plain dangling reference and its effects depend on the phase of the moon, for example the mere presence of Test02. The workaround is of course to follow the advice of the warning or else to move the instantiation of Float_Sanitized to the enclosing procedure.