public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8453: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor.
@ 2002-11-07 8:29 mmitchel
0 siblings, 0 replies; 3+ messages in thread
From: mmitchel @ 2002-11-07 8:29 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, sunil.k.davasam, sunil.k.davasam
Synopsis: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor.
State-Changed-From-To: analyzed->closed
State-Changed-By: mmitchel
State-Changed-When: Thu Nov 7 08:29:26 2002
State-Changed-Why:
Not a bug.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8453
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/8453: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor.
@ 2002-11-04 15:04 bangerth
0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2002-11-04 15:04 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, sunil.k.davasam, sunil.k.davasam
Synopsis: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor.
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon Nov 4 15:04:07 2002
State-Changed-Why:
Ouch, this is a serious regression (miscompilation) w.r.t.
2.95...
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8453
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/8453: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor.
@ 2002-11-04 14:46 sunil.k.davasam
0 siblings, 0 replies; 3+ messages in thread
From: sunil.k.davasam @ 2002-11-04 14:46 UTC (permalink / raw)
To: gcc-gnats; +Cc: sunil.k.davasam
>Number: 8453
>Category: c++
>Synopsis: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 04 14:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: sunil.k.davasam@intel.com
>Release: gcc - 3.2
>Organization:
>Environment:
Redhat 8.0 product ( ia32 ),
United Linux 1.0 ( ia64 )
>Description:
Based on C++ ABI, ( Section 3.3.3: Array Construction and Destruction API )
While creating an array of objects, If the constructor throws an exception, call the destructor for any already-constructed elements, and rethrow the exception.
In the following example, The testcase wants to create an array of 4 objects. While creating 3rd object, it throws an exception. So, based on C++ ABI, destructors should be called for already constructed first 2 elements.
When I compiled the testcase with gcc 3.2 compiler, I am getting different output.
Contents of file : tt.cpp
-------------------------
#include <stdio.h>
static int i = 0;
struct C3
{
C3() {
if ( i == 2 )
throw 1;
else
i++;
printf("%sC%d()\n", "", 3);
}
~C3() {
printf("%sC%d()\n", "~", 3);
}
};
C3 o3[4];
int main()
{
return 0;
}
[cmd_prompt]$ g++ tt.cpp
[cmd_prompt]$ a.out
C3()
C3()
Abort (core dumped)
-----------
Expected output:
C3()
C3()
~C3()
~C3()
Abort (core dumped)
-----------
gcc compiler version:
[cmd]$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i
386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 (Red Hat Linux Rawhide 3.2-1)
Actually I tried on both IA32 and IA64 platforms.
IA32 - Redhat Linux 8.0 product
IA64 - United Linux 1.0
--------
>How-To-Repeat:
[cmd_prompt]$ g++ tt.cpp
[cmd_prompt]$ a.out
C3()
C3()
Abort (core dumped)
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-11-07 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-07 8:29 c++/8453: ABI Issue: Destructors for already constructed objects not called when the exception is thrown inside constructor mmitchel
-- strict thread matches above, loose matches on Subject: below --
2002-11-04 15:04 bangerth
2002-11-04 14:46 sunil.k.davasam
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).