This implements the "observable_checkpoint()" functionality that serves
as an epoch delimiter in the source code, where it stipulates that any
code before this (and the checkpoint) are considered observable.

When code that would exhibit undefined behaviour if reached is seen then
that can result in optimisations eliding both that code and any code
that only reaches it (so-called time-traveling optimisations).  The
epoch marker serves to bound how far such optimisations might travel.

As noted in the library section of the patch, GCC currently treats stdio
operations as equivalent (i.e. they are observable already) and so we have
not added additional checkpoints there.

This patch (with the original shorter name) has been in use on the contracts
development branch for almost a year, and has been tested in isolation on
x86_64-darwin and powerpc64le-linux.


Iain Sandoe (2):
  c++: Implement P1494 and P3641 Partial program correctness [PR119060].
  libstdc++: Implement P1494 and P3641 Partial program correctness
    [PR119060]

 gcc/builtins.cc                               |   4 +
 gcc/builtins.def                              |   1 +
 gcc/c-family/c-common.cc                      |   1 +
 gcc/c-family/c-common.h                       |   1 +
 gcc/cp/cp-objcp-common.cc                     |   1 +
 gcc/cp/cxxapi-data.csv                        |   1 +
 gcc/cp/parser.cc                              |  17 +++
 gcc/cp/std-name-hint.gperf                    |   1 +
 gcc/cp/std-name-hint.h                        | 142 +++++++++---------
 .../g++.dg/cpp26/observable-checkpoint.C      |  24 +++
 libstdc++-v3/include/bits/version.h           |  10 ++
 libstdc++-v3/include/std/utility              |  19 +++
 12 files changed, 152 insertions(+), 70 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp26/observable-checkpoint.C

-- 
2.39.2 (Apple Git-143)

Reply via email to