C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] UB

From: Jₑₙₛ Gustedt <jens.gustedt_at_[hidden]>
Date: Tue, 23 May 2023 18:21:00 +0200
Hello,

on Mon, 22 May 2023 14:52:10 -0700 you (Hans Boehm via Liaison
<liaison_at_[hidden]>) wrote:

> As has been pointed out in some similar discussion, it's a bit tricky
> to define precisely what it means to "occur before an operation that
> has UB". I suspect we mostly mean "strongly happens before", but that
> leaves questions about where UB occurs.

Yes, I also have difficulties to understand what the concept would
mean in the case of race conditions. The text in the C standard says

   The execution of a program contains a data race if it contains two
   conflicting actions in different threads, at least one of which is
   not atomic, and neither happens before the other. Any such data
   race results in undefined behavior.

So a concrete data race is even defined by the absence of ordering,
and for me it is not clear then which side effects can be considered
to have taken place. (E.g there may be side effects that are strictly
ordered with one of the racing accesses, but not with the other.)

The difference here is that for parallel programs we don't need

    "this execution has so far not met a racing access to data"

but we need

    "no execution will ever meet a racing access to data".

Maybe there is the possibility to extend the notion of race condition
to a concrete interpretation, but I don't think that this obvious, and
I also don't think that just a Note as proposed would be sufficient to
clarify this.


Thanks
Jₑₙₛ

-- 
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2023-05-23 16:21:04