<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:sohachak@mpi-sws.org" title="soham <sohachak@mpi-sws.org>"> <span class="fn">soham</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - Wrong transformation due to semantic gap between C11 and LLVM semantics"
href="http://llvm.org/bugs/show_bug.cgi?id=22514">bug 22514</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - Wrong transformation due to semantic gap between C11 and LLVM semantics"
href="http://llvm.org/bugs/show_bug.cgi?id=22514#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - Wrong transformation due to semantic gap between C11 and LLVM semantics"
href="http://llvm.org/bugs/show_bug.cgi?id=22514">bug 22514</a>
from <span class="vcard"><a class="email" href="mailto:sohachak@mpi-sws.org" title="soham <sohachak@mpi-sws.org>"> <span class="fn">soham</span></a>
</span></b>
<pre>Reference
----------
ISO/IEC 14882:2011 Programming Language C++
Link: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf</a>
<span class="quote">> The R_sc(X,1) in readA() reads-from W_sc(X,1) in writeA() which results in
> synchronization</span >
>> That is not correct; no synchronization happens here.
29.3 page - 1116
>From 1.
"memory_order_release, memory_order_acq_rel, and memory_order_seq_cst: a store
operation performs
a release operation on the affected memory location."
>From 2.
"An atomic operation A that performs a release operation on an atomic object M
synchronizes with an atomic
operation B that performs an acquire operation on M and takes its value from
any side effect in the release
sequence headed by A."
Considering these the R_sc(x,1) in readA() reads-from W_sc(x,1) in writeA()
which results in synchronization.
<span class="quote">> and W_na(a,42) happens-before R_na(a,42)</span >
<span class="quote">>> No, there is no happens-before relation here.</span >
1.10 [intro.multithreaded] page 13-14
"
11 An evaluation A inter-thread happens before an evaluation B if
— A synchronizes with B, or
— A is dependency-ordered before B, or
— for some evaluation X
— A synchronizes with X and X is sequenced before B, or
— A is sequenced before X and X inter-thread happens before B, or
— A inter-thread happens before X and X inter-thread happens before B.
"
"
12 An evaluation A happens before an evaluation B if:
— A is sequenced before B, or
— A inter-thread happens before B
"
In our example x=1 and x==1 synchronizes(sw); hence x=1 happens-before(hb)
x==1.
Also a=42; is sequenced before(sb) x=1 in writeA() and in readA() x==1 is
sequenced before r1=a.
Hence a=42 ->(sb) x=1 ->(sw) x==1 ->(sb) r1=a which means a=42 ->(hb) r1=a and
the program is not racy.
If you reopen this again, please provide an explanation of why you think there
is a happens-before relation here, referencing the rules in [intro.multithread]
in the C++ standard to justify the steps in your explanation.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>