public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/113893] New: Finalization exception issue with anonymous access object.
@ 2024-02-12 20:35 p.p11 at orange dot fr
  2024-02-14 15:54 ` [Bug ada/113893] finalization issue with anonymous access object of local type ebotcazou at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: p.p11 at orange dot fr @ 2024-02-12 20:35 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-26 12:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 20:35 [Bug ada/113893] New: Finalization exception issue with anonymous access object p.p11 at orange dot fr
2024-02-14 15:54 ` [Bug ada/113893] finalization issue with anonymous access object of local type ebotcazou at gcc dot gnu.org
2024-02-14 15:55 ` ebotcazou at gcc dot gnu.org
2024-02-14 16:13 ` ebotcazou at gcc dot gnu.org
2024-02-14 17:36 ` ebotcazou at gcc dot gnu.org
2024-02-26 12:20 ` [Bug ada/113893] finalization of object allocated by anonymous access type designating " cvs-commit at gcc dot gnu.org
2024-02-26 12:22 ` cvs-commit at gcc dot gnu.org
2024-02-26 12:23 ` cvs-commit at gcc dot gnu.org
2024-02-26 12:24 ` cvs-commit at gcc dot gnu.org
2024-02-26 12:26 ` ebotcazou at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).