From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8043938AA24C; Tue, 15 Nov 2022 19:24:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8043938AA24C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668540297; bh=J1YWVP9C7YqgcOJnsckdpnj1s+d+mIUgKYQGyEvZxek=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QF4x+svgAWVhT5f0WRaZm8JvX8609bo3cucLd8Ded9zHZWv+WQ5vmGPz4H1LAEL2b Bh4kAUgF1yG+/VRge8IT57hZ0F0oGcypzQckWZQJKUVg2hYitw2/MsgE0QokH6AdWL ZaUsJLHceqxJJcbcrQMXZZebNUAxb4w/JP2lPSi0= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107660] Running binaries compiled with g++11 or later produces different results than g++ version 10 or earlier Date: Tue, 15 Nov 2022 19:24:56 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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_status everconfirmed 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=3D107660 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |UNCONFIRMED Ever confirmed|1 |0 --- Comment #8 from Jonathan Wakely --- Thanks for the reduced example code, I can see what the problem is now. The mt19937 engine produces consistent results, but the commit that Andrew linked to alters the output of std::uniform_int_distribution, due to a different (much faster) algorithm used to downscale the random bits produce= d by std::mt19937 to the number of elements being shuffled. The only requirement= on the uniform_int_distribution is that it produces values uniformly distribut= ed between the minimum and maximum values. Unlike std::mt19937 it doesn't have= to produce a specific sequence of values. I supposed we could add a macro that disables the new fast implementation, = for users who prefer to get the same sequence of values as GCC 10, even though = it's slower.=