https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113893
Bug ID: 113893 Summary: Finalization exception issue with anonymous access object. Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: p.p11 at orange dot fr CC: dkm at gcc dot gnu.org Target Milestone: --- Created attachment 57403 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57403&action=edit Reproducer. In the source code, two procedures: Test01 which uses Ada.Finalization and Test02 which doesn't. When executing only Test01, the Finalize calls of 2 objects and 2 anonymous access objects seem correct: overriding procedure Finalize (Object : in out Container) is begin Ada.Text_IO.Put_Line ("Current:" & Image (Object.Data)); end Finalize; $ ./bin/test_20210208_fin Test01: Value: 2.64000E+01 Current: 8.80000E+00 Current: 2.64000E+01 Current: 6.60000E+00 Current: 7.70000E+00 When executing Test01 then Test02, all the Finalize calls aren't displayed but an exception occurs: $ ./bin/test_20210208_fin Test01: Value: 2.64000E+01 Current: 8.80000E+00 Current: 2.64000E+01 Test02: Value: 2.64000E+01 Execution of ./bin/test_20210208_fin terminated by unhandled exception raised CONSTRAINT_ERROR : erroneous memory access I understand the compiler warning: test_20210208_fin.adb:29:09: warning: object designated by anonymous access object might not be finalized until its enclosing library unit goes out of scope [enabled by default] But, what could be wrong with the exception? (Full code in attachment)