From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8354B3858001; Mon, 1 Nov 2021 19:14:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8354B3858001 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/103022] std::begin on empty std::valarray causes _GLIBCXX_DEBUG assertion Date: Mon, 01 Nov 2021 19:14:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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, 01 Nov 2021 19:14:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103022 --- Comment #3 from CVS Commits --- The releases/gcc-11 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:0111975c07233512e63371b2bc99f88d9670bbc9 commit r11-9198-g0111975c07233512e63371b2bc99f88d9670bbc9 Author: Jonathan Wakely Date: Mon Nov 1 11:06:51 2021 +0000 libstdc++: Fix range access for empty std::valarray [PR103022] The std::begin and std::end overloads for std::valarray are defined in terms of std::addressof(v[0]) which is undefined for an empty valarray. libstdc++-v3/ChangeLog: PR libstdc++/103022 * include/std/valarray (begin, end): Do not dereference an empty valarray. Add noexcept and [[nodiscard]]. * testsuite/26_numerics/valarray/range_access.cc: Check empty valarray. Check iterator properties. Run as well as compiling. * testsuite/26_numerics/valarray/range_access2.cc: Likewise. * testsuite/26_numerics/valarray/103022.cc: New test. (cherry picked from commit 91bac9fed5d082f0b180834110ebc0f46f97599a)=