Issue 116 in data-race-test: False positive with asm release semantic and atomic_compare_and_exchange

4 views
Skip to first unread message

data-ra...@googlecode.com

unread,
Nov 15, 2013, 2:41:27 AM11/15/13
to data-ra...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 116 by chatelet...@gmail.com: False positive with asm release
semantic and atomic_compare_and_exchange
http://code.google.com/p/data-race-test/issues/detail?id=116

Full story described here https://github.com/OpenImageIO/oiio/issues/720.

Short story :
https://github.com/OpenImageIO/oiio/blob/master/src/include/thread.h l.542
implements a spin lock.
TSan reports data race with one write l.568
> // Fastest way to do it is with a store with "release" semantics
> __asm__ __volatile__("": : :"memory");
> m_locked = 0; <<<< this line

and a compare and exchange l.597
> return atomic_compare_and_exchange (&m_locked, 0, 1);

m_locked is of type `volatile int`.

There is already a debate in the above mentioned thread about the
usefulness of volatile. I'm not a low level concurrency expert so I
actually don't know if the asm code has the correct semantic or not.

Environment:
- clang version 3.3 (tags/RELEASE_33/final)
- Arch Linux x86_64, kernel 3.11.6-1-ARCH

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

data-ra...@googlecode.com

unread,
Nov 15, 2013, 3:08:54 AM11/15/13
to data-ra...@googlegroups.com

Comment #1 on issue 116 by dvyu...@google.com: False positive with asm
release semantic and atomic_compare_and_exchange
http://code.google.com/p/data-race-test/issues/detail?id=116

Are you using the old Valgrind-based tsan, or the new clang-based tsan?

data-ra...@googlecode.com

unread,
Nov 15, 2013, 3:12:36 AM11/15/13
to data-ra...@googlegroups.com

Comment #2 on issue 116 by chatelet...@gmail.com: False positive with asm
release semantic and atomic_compare_and_exchange
http://code.google.com/p/data-race-test/issues/detail?id=116

New clang based tsan

data-ra...@googlecode.com

unread,
Nov 15, 2013, 3:14:46 AM11/15/13
to data-ra...@googlegroups.com
Updates:
Status: WontFix

Comment #3 on issue 116 by dvyu...@google.com: False positive with asm
release semantic and atomic_compare_and_exchange
http://code.google.com/p/data-race-test/issues/detail?id=116

Please move the request to:
https://code.google.com/p/thread-sanitizer/issues/list
This project is for old tsan and is unmaintained.
Reply all
Reply to author
Forward
0 new messages