public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "garynot at comcast dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/51940] New: Ada.Finalization of passed function return value skipped if exception raised in routine
Date: Sun, 22 Jan 2012 10:19:00 -0000	[thread overview]
Message-ID: <bug-51940-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51940

             Bug #: 51940
           Summary: Ada.Finalization of passed function return value
                    skipped if exception raised in routine
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: garynot@comcast.net


Created attachment 26409
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26409
Sample failing program.  Very simple code.

When a finalizable value is returned as a function result and passed to a
routine, if that routine terminates with an exception then the Finalization
routine is not called on the function result.  The value thus escapes from
finalization control when it should not.

gcc -c -gnata -gnatE -fstack-check -gnatef -gnatf -gnatm50 -gnatn -gnato
-gnatwe -gnatwi -gnatwj -gnatwK -gnatwl -Wuninitialized -gnatVa
-pass-exit-codes -O -g -I- -gnatA /home/geb/foo.gnat.bug4/pb_code_main.adb
gnatbind -E -m50 -Sin -static -we -I- -x
/home/geb/foo.gnat.bug4/pb_code_main.ali
gnatlink /home/geb/foo.gnat.bug4/pb_code_main.ali -g -v -o
/home/geb/foo.gnat.bug4/pb_code_main
./pb_code_main

Initialize 3216937700 0
Value'Address 3216937700 0
---0---- 0
Adjust 3216937680 0
A'Address 3216937680 1
Finalize 3216937680 1
---1---- 0
Adjust 3216936828 0
X'Address 3216936828 1
Adjust 134716096 1
Finalize 3216936828 2
Adjust 3216937668 1
Finalize 134716096 2
B'Address 3216937668 1
Finalize 3216937668 1
---2---- 0
Adjust 3216936828 0
X'Address 3216936828 1
Adjust 134716096 1
Finalize 3216936828 2
Y'Address 134716096 1
**Notice lack of Finalization call on Y**
---3---- => 1
Adjust 3216936828 1
X'Address 3216936828 2
Adjust 134716096 2
Finalize 3216936828 3
Y'Address 134716096 2
**Notice lack of Finalization call on Y**
**Notice That both Y's have same address, so Y was deallocated or reused
without Finalization**
---4---- => 2
---5---- 2
Finalize 3216937700 2


             reply	other threads:[~2012-01-22  2:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-22 10:19 garynot at comcast dot net [this message]
2012-01-22 22:22 ` [Bug ada/51940] " ebotcazou at gcc dot gnu.org
2012-01-23  1:49 ` garynot at comcast dot net
2012-01-23  9:27 ` ebotcazou at gcc dot gnu.org
2012-01-24  7:46 ` garynot at comcast dot net
2012-01-24  8:05 ` ebotcazou at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-51940-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).