From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EF4733858C83; Wed, 15 Mar 2023 20:54:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF4733858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678913693; bh=7btzMz7rdXvuzWTXWKP3flH2RQQJ+tCCqYnQekYPtjs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BBYSbWzaQiJMXdD85Jr+Y4DgwNA2LIPdkWtNjGa19fClckfcnmCDTyBDRX50HZioO K8NFZf3fpjGODsRYHy1GSbVAAVsN+58YcugcAzrxGHXgcG2BKRykrnSjSqRXjBZDxX 1WFGsmZQg9ycw3QcZ9Qj8oB7twHXyl7zDKhUv0M8= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109150] std::fill should use __gnu_cxx::__is_scalar overloads for all scalars Date: Wed, 15 Mar 2023 20:54:53 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW 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_status everconfirmed cf_reconfirmed_on 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109150 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2023-03-15 --- Comment #1 from Jonathan Wakely --- This terminates with an exception, but I think it's valid. #include const int global =3D 0; struct X { void operator=3D(const int& i) { if (&i !=3D &global) throw 1; } }; int main() { X x; std::fill(&x, &x+1, global); } So I think the std::fill (and std::fill_n) optimizations need to consider t= he iterator's value type as well as the _Tp type.=