From mboxrd@z Thu Jan 1 00:00:00 1970 From: ksingh@oz.agile.tv To: gcc-gnats@gcc.gnu.org Subject: c++/3948: Two destructors are called when no copy destructor is defined Date: Sun, 05 Aug 2001 21:06:00 -0000 Message-id: <20010806035805.10794.qmail@sourceware.cygnus.com> X-SW-Source: 2001-08/msg00100.html List-Id: >Number: 3948 >Category: c++ >Synopsis: Two destructors are called when no copy destructor is defined >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Aug 05 21:06:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Kalvinder Singh >Release: GCC-3.0 >Organization: >Environment: Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs Configured with: ../configure Thread model: single gcc version 3.0 >Description: Quote from Nathan Sidwell in main, we copy construct two C objects during the call to Foo. Foo gets one of these by value, which is dtor'd in Foo. upon return we dtor the other one. I think this is a problem with the pass-by-value ABI method. It does look like a bug. End Quote >How-To-Repeat: Compile and run the attached program >Fix: None >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="kulvinder.C" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="kulvinder.C" CgojaW5jbHVkZSA8c3RkaW8uaD4KCmNsYXNzIEMKewogIGludCBtOwogIApwdWJsaWM6CiAgQygp IHtwcmludGYgKCJjdG9yICVzICVwXG4iLCBfX1BSRVRUWV9GVU5DVElPTl9fLCAodm9pZCAqKXRo aXMpO307CiAgfkMoKSB7cHJpbnRmICgiZHRvciAlcyAlcFxuIiwgX19QUkVUVFlfRlVOQ1RJT05f XywgKHZvaWQgKil0aGlzKTt9Owp9OwoKCnZvaWQgRm9vIChDIGMpIHtwcmludGYgKCJpbiBGb28g JXBcbiIsICh2b2lkICopJmMpO30KCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pCnsg ICAgICAgCiAgQyBjOwoKICBwcmludGYgKCJCZWZvcmUgRm9vIGluIG1haW4gXG4iKTsKICBGb28g KGMpOwogIHByaW50ZiAoIkFmdGVyIEZvbyBpbiBtYWluIFxuIik7CiAgcmV0dXJuIDE7Cn0K