Commit 59d01631 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

work around a miscompile crashing DistributedMutex::unlock

Summary: Under gcc8 in some usages, the compiler emits a stack copy of the proxy state but passes `7` instead of the address of the stack copy. Looks like incorrect codegen. Work around that bug by not having a stack copy.

Reviewed By: aary

Differential Revision: D28890467

fbshipit-source-id: 50b16464708c7ef3e360618f3d738264f59cf8a6
parent b42e5ace
......@@ -1533,7 +1533,8 @@ bool tryUnlockClean(Atomic& state, Proxy& proxy, Sleepers sleepers) {
template <template <typename> class Atomic, bool Publish>
void DistributedMutex<Atomic, Publish>::unlock(
DistributedMutex::DistributedMutexStateProxy proxy) {
DistributedMutex::DistributedMutexStateProxy const& proxy_) {
auto proxy = proxy_;
// we always wake up ready threads and timed waiters if we saw either
DCHECK(proxy) << "Invalid proxy passed to DistributedMutex::unlock()";
DCHECK(!proxy.combined_) << "Cannot unlock mutex after a successful combine";
......
......@@ -189,7 +189,7 @@ class DistributedMutex {
* It is undefined behavior to unlock from a thread that did not lock the
* mutex
*/
void unlock(DistributedMutexStateProxy);
void unlock(DistributedMutexStateProxy const&);
/**
* Try to acquire the mutex
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment