> Am 28.02.2025 um 20:02 schrieb Martin Uecker <uec...@tugraz.at>:
>
> Am Freitag, dem 28.02.2025 um 21:39 +0300 schrieb Alexander Monakov:
>>> On Fri, 28 Feb 2025, Martin Uecker via Gcc wrote:
>>>
>>>
>>> I have one follow-up question: What is the reason
>>> that we have stronger semantics for stores by default (i.e.
>>> when not using -fallow-store-data-races) than for reads
>>> given that the standard would allow more freedom.
>>
>> Why would it? On the contrary, it makes an explicit note that
>> introducing new writes that could create a racing store is
>> not allowed, see note 13 in C11 5.1.2.4.
>
> My original question was about inventing stores that currently
> seem to be allowed. Turning
>
> if (x != 1)
> x = 1;
>
> into
>
> x = 1;
>
> should be ok even though it invents a store for x == 1.
>
> While this technically introduces a race with another
> reader, it does so only in a seeminglessly harmless way
> when overwriting 1 with 1.
>
> Are you saying -fallow-store-data-races also introduces
> other kinds of races not allowed by C11?
The default is -fno-allow-store-data-races
> Martin
>
>>
>>> Only that for reads this is more difficult to have?
>>> Or other specific reasons why data races for stores
>>> are problematic?
>>
>> Introducing racing loads is generally not harmful, see note 14.
>
>
>
>
>