On 28.09.2022 16:27, Roger Pau Monné wrote:
> On Wed, Sep 28, 2022 at 02:12:30PM +0200, Jan Beulich wrote:
>> While for some of the functions there's locking involved, the acquiring
>> and releasing of a lock doesn't alter program state when comparing
>> "before" and "after" the function invocations. Furthermore without
>> (further) locking by callers, return values are stale anyway by the time
>> they can be evaluated. Hence both CSE and DCE are okay to occur for
>> invocations of these functions.
>>
>> Signed-off-by: Jan Beulich <jbeul...@suse.com>
>> ---
>> RFC for the (imo) ambiguous wording in documentation.
> 
> What happens if the contents of the rangeset is modified outside of
> the scope of the function.  Ie: would for example:
> 
> while ( !rangeset_is_empty(...) );
> 
> Become an infinite loop then, without taking into account that the
> rangeset can be externally modified?
> 
> It's not clear to me whether the elimination of repeated calls take
> into account that the observed variable can be externally modified?

Hmm, right, this actually matches the feof() counter-example that the
gcc doc has. So I guess I need to withdraw the patch and we will need
to live with these functions not being possible to eliminate even in
cases where it would be okay (and helpful).

Jan

Reply via email to