public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95103] Unexpected -Wclobbered in bits/vector.tcc with -O2 Date: Thu, 14 May 2020 10:22:56 +0000 [thread overview] Message-ID: <bug-95103-4-nTJW6MZS28@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95103-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95103 --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- The content of the warning isn't very helpful, but I think it's pointing out a real issue in the code, not a false positive. Any valid longjmp which followed that setjmp would have undefined behaviour if executed, because 'v' has a non-trivial destructor. The current wording is unclear, but CWG 2361 should clarify it, and LWG 1265 (closed as NAD) suggested different wording which would re-formulate the function as: void f3() try { std::vector<S> v; for (int i = 0; i != 2; ++i) { if (!f2("xx")) f1(); v.push_back(0); } // ... } catch (...) { } An exception thrown from the "..." part would cause the destruction of 'v' and since that destructor is non-trivial, it would have undefined behaviour.
next prev parent reply other threads:[~2020-05-14 10:22 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-13 12:10 [Bug c++/95103] New: " sbergman at redhat dot com 2020-05-14 6:14 ` [Bug c++/95103] " rguenth at gcc dot gnu.org 2020-05-14 6:36 ` sbergman at redhat dot com 2020-05-14 9:33 ` amonakov at gcc dot gnu.org 2020-05-14 10:22 ` redi at gcc dot gnu.org [this message] 2020-05-14 10:35 ` amonakov at gcc dot gnu.org 2021-07-22 22:25 ` [Bug middle-end/95103] " pinskia at gcc dot gnu.org
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-95103-4-nTJW6MZS28@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).