Skip to content

Commit 1db91dd

Browse files
committed
Set status=SG1 and priority for 4177
1 parent aaf570c commit 1db91dd

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

xml/issue4177.xml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?xml version='1.0' encoding='utf-8' standalone='no'?>
22
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
33

4-
<issue num="4177" status="New">
4+
<issue num="4177" status="SG1">
55
<title>&sect;[atomics.order] p8 "circularly depend on their own computation" is unclear for loop</title>
66
<section><sref ref="[atomics.order]"/></section>
77
<submitter>jim x</submitter>
88
<date>29 Nov 2024</date>
9-
<priority>99</priority>
9+
<priority>4</priority>
1010

1111
<discussion>
1212
<p>
@@ -51,6 +51,55 @@ if the loop doesn't exit.
5151
Either accurately specify what "circularly depend on their own computation" means, or add a paradigmatic
5252
example regarding loop to indicate what it means.
5353
</p>
54+
55+
<note>Additional discussion from submitter:</note>
56+
<p>
57+
I meant, that for a classic spin-lock, the code after the loop won't be
58+
executed until the loop exits, and the operation is just a pure load with
59+
relaxed memory order during the busy wait.
60+
The loop for a spin-lock can have three possible cases:
61+
<ol>
62+
<li>CAS immediately succeeds </li>
63+
<li>the loop exits after certain times of iterations</li>
64+
<li>the loop cannot be exited(e.g. the lock is not released)</li>
65+
</ol>
66+
</p>
67+
<p>
68+
The compiler cannot assume which case the loop for the spin-lock is.
69+
The code after the loop won't be reordered(during the busy waiting with
70+
a relaxed memory order); otherwise, implementing the spin-lock would be
71+
an issue based on the assumption that the codes after the loop wouldn't
72+
be reached when the loop was busy waiting.
73+
</p>
74+
<p>
75+
In this example, the loop has the same possible cases as the loop
76+
in the spin-lock. So, the execution of `#5` seems to depend on the loop
77+
and the loop depends on the `pre`. why I mention the spin-lock just is to
78+
justify that the code after the loop won't be reordered in both compile-time
79+
and runtime even though the condition of the loop is a pure load with a relaxed
80+
memory order(otherwise, the foundation for which the busy-waiting of a
81+
spink-lock is based on won't be true.). So, the loop has a similar effect
82+
to the `if` statement on the control flow: the code in the block of
83+
the `if` statement won't be executed if the condition is false, as well,
84+
the code after the loop won't be executed if the loop hasn't yet exited.
85+
</p>
86+
87+
<note>2025-02-07; Reflector poll</note>
88+
<p>
89+
Set priority to 4 after reflector poll. Send to SG1.
90+
</p>
91+
<p>
92+
"Should the example use `unsigned` so there's no chance of UB due to `int`
93+
overflowing?"
94+
</p>
95+
<p>
96+
"Contrived example showing well-known fact that OOTA prohibition is just
97+
hand-waving. <paper num="N3786"/> introduced the current wording and made
98+
no secret of that. <paper num="P1217"/> explored the issue further,
99+
as have other SG1 papers. Hard problems. Solutions welcome. Don't think this
100+
is the place to focus however."
101+
</p>
102+
54103
</discussion>
55104

56105
<resolution>

0 commit comments

Comments
 (0)