public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: pere@hungry.com To: gcc-gnats@gcc.gnu.org Subject: c++/3194: to many calls to copy ctor Date: Fri, 15 Jun 2001 05:56:00 -0000 [thread overview] Message-ID: <20010615125008.17882.qmail@sourceware.cygnus.com> (raw) >Number: 3194 >Category: c++ >Synopsis: to many calls to copy ctor >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Fri Jun 15 05:56:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Petter Reinholdtsen >Release: gcc 2.95.2 and 3.0 2001-06-15 >Organization: >Environment: Debian 2.2 >Description: Given the following test program, gcc 2.95.2 behaves very different with and without an explicit copy constructor. Without With ------------------------------------------------ ctor default 0xbffff628 ctor default 0xbffff628 foo ctor 1 dtor 0 foo ctor 1 dtor 0 dtor default 0xbffff604 dtor default 0xbffff628 dtor default 0xbffff628 ctor temp 0xbffff628 ctor temp 0xbffff624 foo ctor 2 dtor 1 foo ctor 2 dtor 2 dtor temp 0xbffff628 dtor temp 0xbffff604 ctor live 0xbffff628 dtor temp 0xbffff624 cctor live 0xbffff624 ctor live 0xbffff620 foo ctor 4 dtor 2 foo ctor 3 dtor 4 dtor live 0xbffff624 dtor live 0xbffff604 dtor live 0xbffff628 dtor live 0xbffff61c dtor live 0xbffff620 Notice how the default copy constructor is called even if it isn't needed. >How-To-Repeat: Compile and run the enclosed test program. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="defaultparm.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="defaultparm.cpp" LyoKCkdpdmVuIHRoZSBmb2xsb3dpbmcgdGVzdCBwcm9ncmFtLCBnY2MgMi45NS4yIGJlaGF2ZXMg dmVyeSBkaWZmZXJlbnQKd2l0aCBhbmQgd2l0aG91dCBhIGNvcHkgY29uc3RydWN0b3IuCgogIFdp dGhvdXQgICAgICAgICAgICA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IGN0b3IrKzsgcHJpbnQoImN0b3IiKTsgfTsKICAvLyBGbGlwIHRoaXMg c3dpdGNoIHRvIGNoYW5nZSB0aGUgYmVoYXZvaXVyCiNpZiBub3RfdXNpbmdfZGVmYXVsdF9jb3B5 X2N0b3IKICBUZXN0KGNvbnN0IFRlc3QmIHQpIDogbV9uYW1lKHQubV9uYW1lKSB7IGN0b3IrKzsg cHJpbnQoImNjdG9yIik7IH07CiNlbmRpZgogIH5UZXN0KCkgeyBkdG9yKys7IHByaW50KCJkdG9y Iik7IH07CgogIHN0YXRpYyBpbnQgY3RvciwgZHRvcjsKcHJpdmF0ZToKICBjb25zdCBjaGFyICpt X25hbWU7CiAgdm9pZCBwcmludChjb25zdCBjaGFyICpmdW5jKSB7IHByaW50ZigiJXMgJXMgJXBc biIsIGZ1bmMsIG1fbmFtZSwgdGhpcyk7fTsKfTsKCmludCBUZXN0OjpjdG9yID0gMDsKaW50IFRl c3Q6OmR0b3IgPSAwOwoKdm9pZApmb28oVGVzdCB0ID0gVGVzdCgiZGVmYXVsdCIpKQp7CiAgcHJp bnRmKCJmb28gY3RvciAlZCBkdG9yICVkXG4iLCBUZXN0OjpjdG9yLCBUZXN0OjpkdG9yKTsKfQoK aW50IG1haW4oKQp7CiAgZm9vKCk7CiAgZm9vKFRlc3QoInRlbXAiKSk7CgogIFRlc3QgdCgibGl2 ZSIpOwogIGZvbyh0KTsKICByZXR1cm4gMDsKfQo=
next reply other threads:[~2001-06-15 5:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-06-15 5:56 pere [this message] 2002-04-26 3:52 nathan
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=20010615125008.17882.qmail@sourceware.cygnus.com \ --to=pere@hungry.com \ --cc=gcc-gnats@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: linkBe 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).