cplusplus / papers

ISO/IEC JTC1 SC22 WG21 paper scheduling and management
674 stars 18 forks source link

P2434 R2 Nondeterministic pointer provenance #1364

Open jfbastien opened 2 years ago

jfbastien commented 2 years ago

P2434R0 Nondeterministic pointer provenance (S. Davis Herring)

erichkeane commented 2 years ago

EWG supports:

-users verifying that this model meets their needs, particularly for pointer zap -authors work with SG22 and WG14 to align C and C++ solutions -implementation experience be obtained -usage experience be obtained

then we want to see the paper again

SF F N A SA
10 8 1 0 0

Result: Consensus

sebastian-wittmeier-bl-ext commented 2 years ago

link to P2434R0 is broken

jwakely commented 2 years ago

The link looks fine, the paper just hasn't yet been published where the wg21 link bot can find it.

jfbastien commented 1 year ago

Related: #895 #553 #1084 #1011

opensdh commented 8 months ago

@NinaRanns: Should this issue get an update from the SG22 discussion?

NinaRanns commented 8 months ago

probably :) SG22 had a meeting to discuss the issue. WG14 felt the wording presented in P2434 doesn't solve the problem from WG14 perspective. The room didn't find a common way forward. Notes from the meeting can be found here

wg21bot commented 6 months ago

P2434R1 Nondeterministic pointer provenance (S. Davis Herring)

hanickadot commented 5 months ago

P2434r1 Nondeterministic pointer provenance: Expand the paper to specify the special angelic behavior on std::atomic<T*>.

SF F N A SA
2 7 8 3 0

Not consensus (too many neutrals).

P2434R1 Nondeterministic pointer provenance: forward to SG1/CWG/LEWG for inclusion in C++26.

SF F N A SA
7 11 2 0 0

Consensus.

jensmaurer commented 5 months ago

CWG 2024-06-25: Brief discussion on differences between WG14 (superimposed pointer values) and WG21 (angelic nondeterminism) approaches. Provenance of integers (and erasure thereof with arithmetic) mentioned.

jensmaurer commented 5 months ago

CWG 2024-06-27 in St. Louis: Reviewed; needs updates.

ogiroux commented 5 months ago

SG1 in St Louis

SG1 believes that the approach of P2434R1 can address the zap problem with some additional (simpler) changes e.g.:

  1. Convenience / future-proofing in casts & atomics
  2. Tightening invalid-pointer semantics SF F N A SA 3 7 1 0 0 Unanimous consent
wg21bot commented 1 month ago

P2434R2 Nondeterministic pointer provenance (S. Davis Herring)

xmh0511 commented 2 weeks ago

There is still an issue for the wording in this paper

A pointer value P is valid in the context of an evaluation E if P is a null pointer value, or if it is a pointer to or past the end of an object O and E happens after the beginning and happens before the end of the duration of the region of storage for O. […]

Consider this example:

int main(){
   auto p = new int{0};
   *p  =10;  // E
}

There is no deallocation in this program, so the expression E happens before the end of the duration is unknown, in other words, Is the pointer valid when we leak the memory?

jensmaurer commented 4 days ago

CWG 2024-11-22 in Wroclaw: CWG found the following example from the paper a rather surprising consequence for optimizers, and asks EWG to affirm this consequence is expressly acknowledged:

void f(T* p) {
  T* t = new T();
  if (opaque_fn(t)) {
    // *t and *p can alias here
  }
}