From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 95F2B388703F; Tue, 23 Feb 2021 13:56:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95F2B388703F From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/99117] [9/10/11 Regression] cannot accumulate std::valarray Date: Tue, 23 Feb 2021 13:56:30 +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: 10.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 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: Tue, 23 Feb 2021 13:56:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99117 --- Comment #15 from Jakub Jelinek --- So, based on IRC discussion, the problem is that in: template template inline valarray<_Tp>& valarray<_Tp>::operator=3D(const _Expr<_Dom, _Tp>& __e) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 630. arrays of valarray. if (_M_size =3D=3D __e.size()) std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); the temporary _Array<_Tp>(_M_data) object's _M_data passed to __valarray_co= py doesn't fully own the object and that __e's operator[] aliases with that. Can't libstdc++ for cases where such aliasing is possible use an _Array-like class without the __restrict (i.e. something that wouldn't lie to the compi= ler that it fully owns it)?=