public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/108554] Warning "null pointer dereferece" raised when extracting a unique_ptr from a map and any "-O" flag Date: Thu, 26 Jan 2023 13:38:37 +0000 [thread overview] Message-ID: <bug-108554-4-aAmwqkpHPM@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108554-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108554 --- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>: https://gcc.gnu.org/g:3376467ce090aa0966d59ca3aea35db4f17a4b47 commit r13-5386-g3376467ce090aa0966d59ca3aea35db4f17a4b47 Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu Jan 26 10:55:28 2023 +0000 libstdc++: Add returns_nonnull to non-inline std::map detail [PR108554] std::map uses a non-inline function to rebalance its tree and the compiler can't see that it always returns a valid pointer (assuming valid inputs, which is a precondition anyway). This can result in -Wnull-derefernce warnings for valid code, because the compiler thinks there is a path where the function returns null. Adding the returns_nonnull attribute tells the compiler that is can't happen. While we're doing that, we might as well also add a nonnull attribute to the rebalancing functions too. libstdc++-v3/ChangeLog: PR libstdc++/108554 * include/bits/stl_tree.h (_Rb_tree_insert_and_rebalance): Add nonnull attribute. (_Rb_tree_rebalance_for_erase): Add nonnull and returns_nonnull attributes. * testsuite/23_containers/map/modifiers/108554.cc: New test.
next prev parent reply other threads:[~2023-01-26 13:38 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-26 9:13 [Bug libstdc++/108554] New: " fcontact at cuveland dot de 2023-01-26 9:51 ` [Bug libstdc++/108554] " redi at gcc dot gnu.org 2023-01-26 9:56 ` fcontact at cuveland dot de 2023-01-26 10:11 ` redi at gcc dot gnu.org 2023-01-26 10:14 ` redi at gcc dot gnu.org 2023-01-26 13:38 ` cvs-commit at gcc dot gnu.org [this message] 2023-01-26 13:41 ` [Bug libstdc++/108554] [12 Regression] " redi at gcc dot gnu.org 2023-01-27 15:43 ` cvs-commit at gcc dot gnu.org 2023-03-28 23:35 ` cvs-commit at gcc dot gnu.org 2023-03-28 23:35 ` redi 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-108554-4-aAmwqkpHPM@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).