From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8233C385843B; Tue, 6 Feb 2024 21:28:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8233C385843B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707254892; bh=Vokw7oEs0T20gh9RjofjE4MI16eNOThzpk66f5d5BXI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GsAMpU8cqPXPVVrEZsX6FOQ4uoNCjH3VsTIkqa0qd37YnjmZxC2b8WrdSiUvLrteL iCMT+piU45te9KxRsYv0A5pSvdClH59i9xei+eb7r3/dK/sE2yUBvscTs19VqNjYeR IZHINxMX4EmfKBWKrjv1yC6iCYSglpmfDC9nSyp8= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/87744] Some valid instantiations of linear_congruential_engine produce compiler errors when __int128 isn't available Date: Tue, 06 Feb 2024 21:28:11 +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: 7.3.0 X-Bugzilla-Keywords: rejects-valid 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: 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=3D87744 --- Comment #3 from Jonathan Wakely --- Based on that, I'm not sure what libc++ does is actually better than what libstdc++ does today (i.e. refuse to compile if the results would be wrong). I think the patch above would make sense though. I'm sure it could be optimized, I was more concerned with getting the results right than with performance. The first loop in operator% could just be a single left shift by the differ= ence in the number of leading zeros between __l and __x. And halve() should just= be a right shift (and "halve" isn't a reserved name).=