From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 52695395C820; Tue, 6 Oct 2020 18:54:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52695395C820 From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/97309] New: Improve documentation of -fallow-store-data-races Date: Tue, 06 Oct 2020 18:54:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: qinzhao 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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, 06 Oct 2020 18:54:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97309 Bug ID: 97309 Summary: Improve documentation of -fallow-store-data-races Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- As of GCC 10, the former --param allow-store-data-races is now=20 -fallow-store-data-races. The default, in both cases, is not to allow them= .=20=20=20 For releases prior to GCC 10, the --param is documented as=20 allow-store-data-races=20 Allow optimizers to introduce new data races on stores. Set= =20 to 1 to allow, otherwise to 0.=20 The description for GCC 10 is simply:=20 -fallow-store-data-races=20 Allow the compiler to introduce new data races on stores.=20 Enabled at level -Ofast.=20 There are three problems with this description.=20 (1) The explanation is sparse - basically it just repeats the name of the=20 switch.=20=20=20 (2) It provides no context to explain the circumstances under which it may = or=20 may not be safe to use.=20 (3) Because of the lack of clarity regarding safety, it may be questionable= =20 as to whether a SPEC CPU user is allowed to use -Ofast=20 (http://www.spec.org/cpu2017/Docs/runrules.html#safe)=20 Suggested improvement:=20 Allow the compiler to perform optimizations that may introduce new data rac= es=20 on stores, without proving that the variable cannot be concurrently accesse= d=20 by other threads. Does not affect optimization of local data. It is safe to= =20 use this option if it is known that global data will not be accessed by=20 multiple threads.=20 Examples of optimizations enabled by -fallow-store-data-races include=20 hoisting or if-conversions that may cause a value that was already in memor= y=20 to be re-written with that same value. Such re-writing is safe in a single= =20 threaded context but may be unsafe in a multi-threaded context. Note that o= n=20 some processors, if-conversions may be required in order to enable=20 vectorization.=