public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "michael.ragazzon at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110498] Spurious warnings stringop-overflow and array-bounds copying data as bytes into vector::reserve Date: Tue, 02 Apr 2024 20:20:49 +0000 [thread overview] Message-ID: <bug-110498-4-by91CHW8Cx@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110498-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110498 Michael Ragazzon <michael.ragazzon at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michael.ragazzon at gmail dot com --- Comment #1 from Michael Ragazzon <michael.ragazzon at gmail dot com> --- I seem to also have encountered this issue while using `std::vector<bool>`. Here is a relatively small reproducer. Compile with: -O3 -std=c++17 -Wall -Werror --- #include <stdio.h> #include <vector> class Testing { public: Testing(); private: std::vector<bool> elements; }; Testing::Testing() { // Warning emitted when set to any number in the range [1,64]. constexpr size_t reserve_size = 30; elements.reserve(reserve_size); elements.push_back(0); } int main() { Testing testing; } --- https://godbolt.org/z/eG66sjsPq This issue seems to have started with GCC 13.1, and exists also on current trunk (tested on Compiler Explorer).
next prev parent reply other threads:[~2024-04-02 20:20 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-30 12:21 [Bug libstdc++/110498] New: " rogerio.souza at gmail dot com 2024-04-02 20:20 ` michael.ragazzon at gmail dot com [this message] 2024-04-02 20:24 ` [Bug tree-optimization/110498] " pinskia at gcc dot gnu.org 2024-04-02 20:41 ` michael.ragazzon at gmail dot com
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-110498-4-by91CHW8Cx@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).