public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/51940] New: Ada.Finalization of passed function return value skipped if exception raised in routine
@ 2012-01-22 10:19 garynot at comcast dot net
  2012-01-22 22:22 ` [Bug ada/51940] " ebotcazou at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: garynot at comcast dot net @ 2012-01-22 10:19 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2012-01-24  7:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22 10:19 [Bug ada/51940] New: Ada.Finalization of passed function return value skipped if exception raised in routine garynot at comcast dot net
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

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).