public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amalisperid at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56889] =delete(ing) default copy and move operations for a polymorphic type gives compilation error messages Date: Fri, 12 Apr 2013 03:39:00 -0000 [thread overview] Message-ID: <bug-56889-4-5QmW0FvLCR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-56889-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56889 --- Comment #8 from Amali Praveena <amalisperid at yahoo dot com> 2013-04-12 03:39:35 UTC --- Hi reddit, Yes, it's not a GCC bug. I had a problem with copy constructors in version 4.7.0 but got Internal Compilation Error. I'm now working with GCC 4.8.0 in which this is fixed. I think I got confused with this. I thought of adding these delete functions to the abstract class and test it. Since vector_stack doesn't have any pointer members/ members of its own, I can rely on compiler to generate a default copy constructor for this more derived class of Stack. Option 1: As you say, because I have made copy/move operations in the abstract type(Stack) =delete, I think I should define a default copy constructor/assignment and move constructor/assignment in all more derived classes of Stack. Option 2: Change the clone function. However, Clone pattern is often implemented using copy constructor. Until now, I haven't seen it done in some other ways. Thanks, Amali. ________________________________ From: redi at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> To: amalisperid@yahoo.com Sent: Thursday, 11 April 2013 10:42 PM Subject: [Bug c++/56889] =delete(ing) default copy and move operations for a polymorphic type gives compilation error messages http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56889 --- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-04-11 12:42:52 UTC --- You keep quoting Stroustrup but your code is still broken. Your clone() function copies the object. The object is not copyable. What is so difficult to understand? Add a copy constructor to vector_stack or change the clone function. This is not a GCC bug! >From gcc-bugs-return-419885-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 12 03:45:47 2013 Return-Path: <gcc-bugs-return-419885-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 28544 invoked by alias); 12 Apr 2013 03:45:46 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 28521 invoked by uid 48); 12 Apr 2013 03:45:43 -0000 From: "vapier at gentoo dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/56928] New: false positive when using -Wstrict-overflow Date: Fri, 12 Apr 2013 03:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vapier at gentoo dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: <bug-56928-4@http.gcc.gnu.org/bugzilla/> X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg01030.txt.bz2 Content-length: 1323 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56928 Bug #: 56928 Summary: false positive when using -Wstrict-overflow Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: vapier@gentoo.org Target: x86_64-linux-gnu i've got some code that is triggering a warning when using gcc-4.8.0 and -O2 with -Wstrict-overflow. pretty sure the warning is wrong -- when i tweak the code slightly (in unrelated ways), it goes away. playing with older versions shows that 4.[234].x work, but 4.[5678].x fail the reduced test case: $ cat test.i struct stat { int st_mode; }; const char *foo(char c, int x, struct stat s) { int i; char dynamic = 0; if (c == 1) for (i = 0; i < x; i++) dynamic = 1; if (!dynamic || !(s.st_mode & 1)) return dynamic ? "d" : "!d"; } $ gcc -O2 -c test.i -Wstrict-overflow test.i: In function ‘foo’: test.i:12:24: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow] return dynamic ? "d" : "!d"; ^ >From gcc-bugs-return-419886-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 12 05:06:30 2013 Return-Path: <gcc-bugs-return-419886-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org> Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 19181 invoked by alias); 12 Apr 2013 05:06:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: <gcc-bugs.gcc.gnu.org> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/> List-Post: <mailto:gcc-bugs@gcc.gnu.org> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org> Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 19108 invoked by uid 48); 12 Apr 2013 05:06:26 -0000 From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/56928] [4.6/4.7/4.8/4.9 Regression] false positive when using -Wstrict-overflow Date: Fri, 12 Apr 2013 05:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.4 X-Bugzilla-Changed-Fields: Keywords Status Last reconfirmed Component Target Milestone Summary Ever Confirmed Message-ID: <bug-56928-4-5LkFz8y9Ar@http.gcc.gnu.org/bugzilla/> In-Reply-To: <bug-56928-4@http.gcc.gnu.org/bugzilla/> References: <bug-56928-4@http.gcc.gnu.org/bugzilla/> X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg01031.txt.bz2 Content-length: 1440 http://gcc.gnu.org/bugzilla/show_bug.cgi?idV928 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2013-04-12 Component|c |tree-optimization Target Milestone|--- |4.6.4 Summary|false positive when using |[4.6/4.7/4.8/4.9 |-Wstrict-overflow |Regression] false positive | |when using | |-Wstrict-overflow Ever Confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-04-12 05:06:26 UTC --- Visiting PHI node: dynamic_3 = PHI <0(2), dynamic_2(11)> Argument #0 (2 -> 5 executable) 0 Value: [0, 0] Argument #1 (11 -> 5 executable) dynamic_2 Value: [0, 1] Meeting [0, 0] and [0, 1] to [0, 1] Found new range for dynamic_3: [0, +INF(OVF)] I don't see any overflow there or even a way to cause the overflow. Looks like there is a bad type issue, dynamic is char but it is being treated as a boolean type internally.
prev parent reply other threads:[~2013-04-12 3:39 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-04-09 6:02 [Bug c++/56889] New: " amalisperid at yahoo dot com 2013-04-09 9:10 ` [Bug c++/56889] " daniel.kruegler at googlemail dot com 2013-04-09 9:36 ` daniel.kruegler at googlemail dot com 2013-04-09 12:26 ` redi at gcc dot gnu.org 2013-04-09 19:02 ` amalisperid at yahoo dot com 2013-04-09 19:13 ` daniel.kruegler at googlemail dot com 2013-04-11 12:42 ` redi at gcc dot gnu.org 2013-04-12 3:39 ` amalisperid at yahoo dot com [this message]
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-56889-4-5QmW0FvLCR@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: 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).