From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 58EB43865493; Mon, 13 Jul 2020 15:51:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58EB43865493 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594655509; bh=kdCy3CICuosJOXqDmNW9pRho5ykJr4+NTi8akMlSbbE=; h=From:To:Subject:Date:From; b=PwfeCclSu+1i/LuLy5r+4mCB7yVKzD8ABjgUp/OYN4n+CzCCd2aKZZGdZxIkxbJnv FjevN/rrF/QYUyq6SmTY/oED1PWXoXVZXz+NAoLNoQT1K0zSmv0HyWdJhN6dDDDA6G Wv4c4U8kT7gC2FSESli6TYsxVyIropr9uvAcM0Uc= From: "derek.mauro at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/96188] New: -Wstringop-overflow false positive Date: Mon, 13 Jul 2020 15:51:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: derek.mauro at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2020 15:51:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96188 Bug ID: 96188 Summary: -Wstringop-overflow false positive Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: derek.mauro at gmail dot com Target Milestone: --- This is strange issue that started appearing in gcc 10.1. It also seems to require -O3 and -std=3Dgnu++11 (gnu++14 etc appear unaffected). Godbolt demo: https://godbolt.org/z/W8MWbz Test case copy/pasted below. Use -Werror -Wstringop-overflow -std=3Dgnu++11 -O3 #include #include bool b; void F() { static bool b2 =3D b; for (const int fx : {0}) { struct Expectation { std::string out; }; std::vector expect =3D { {std::string()}, {std::string()}, {std::string()}, }; if (b2) { expect.push_back({std::string()}); } } }=