C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] time travel

From: Uecker, Martin <Martin.Uecker_at_[hidden]>
Date: Fri, 4 Mar 2022 20:01:45 +0000
Am Freitag, den 04.03.2022, 20:48 +0100 schrieb Jens Maurer:
> On 04/03/2022 20.24, Uecker, Martin via Liaison wrote:

...
>
> Here's a web page that claims time-travel across observable
> behavior for clang:
>
> https://blog.regehr.org/archives/232

Thank! The GCC example seems to be the same volatile
issue I also found. The clang examples I need to
investigate more. At the moment I can not reproduce
the case where it moves a division across a function
call. This would also be an incorrect optimization
even with time-travel, so maybe this was fixed.

> > The C standard says:
> >
> > "behavior, upon use of a nonportable or erroneous program
> > construct or of erroneous data, for which this document
> > imposes no requirements"
> >
> > To me the term "behavior" clearly implies something
> > happening at some point of time (either at run-time or
> > compile-time), and consequently "no requirements" only
> > applies to something at a point of time because the
> > words "for which" restrict to what this applies.
>
> Same for C++:
>
> undefined behavior
> behavior for which this document imposes no requirements
>
> but with a lengthy note:
>
> [Note 1 to entry: Undefined behavior may be expected when
> this document omits any explicit definition of behavior
> or when a program uses an erroneous construct or erroneous
> data. Permissible undefined behavior ranges from
> ignoring the situation completely with unpredictable results,
> to behaving during translation or program execution in
> a documented manner characteristic of the environment
> (with or without the issuance of a diagnostic message),
> to terminating a translation or execution (with the issu
> ce of a diagnostic message). Many erroneous program constructs
> do not engender undefined behavior; they are required to be
> diagnosed. Evaluation of a constant expression (7.7)
> never exhibits behavior explicitly specified as undefined
> in Clause 4 through Clause 15. — end note]

Wasn't there also something specifically about
the possible effects on previous observable
behavior or do I misremember this?

Martin


>
> Jens

Received on 2022-03-04 20:01:49