public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/55439] New: ThreadSanitizer: handle atomic operations
@ 2012-11-22  7:42 dvyukov at google dot com
  2012-11-22  7:55 ` [Bug other/55439] " dvyukov at google dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dvyukov at google dot com @ 2012-11-22  7:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55439

             Bug #: 55439
           Summary: ThreadSanitizer: handle atomic operations
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dvyukov@google.com


ThreadSanitizer instrumentation pass need to intercept builtin atomic
operations.
In the other compiler we intercept __sync builtins, __atomic builtins, C1x
Atomic(T) and C1x/C++11 <atomic> atomics and translate them into calls into
runtime library.

For example,
atomic<int32_t> a;
a.load(memory_order_acquire);
is translated into:
__tsan_atomic32_load(&a, 2);

The runtime interface is described in libsanitizer/tsan/tsan_interface_atomic.h


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/55439] ThreadSanitizer: handle atomic operations
  2012-11-22  7:42 [Bug other/55439] New: ThreadSanitizer: handle atomic operations dvyukov at google dot com
@ 2012-11-22  7:55 ` dvyukov at google dot com
  2012-12-04 13:21 ` [Bug sanitizer/55439] " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dvyukov at google dot com @ 2012-11-22  7:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55439

--- Comment #1 from Dmitry Vyukov <dvyukov at google dot com> 2012-11-22 07:54:47 UTC ---
In the other compiler function-scope statics are lowered to inline code that
includes acquire-load atomic operation. So the interception is critical to not
produce false positives. I don't know how function-scope statics are handled in
gcc, but I suspect that it must be similar.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug sanitizer/55439] ThreadSanitizer: handle atomic operations
  2012-11-22  7:42 [Bug other/55439] New: ThreadSanitizer: handle atomic operations dvyukov at google dot com
  2012-11-22  7:55 ` [Bug other/55439] " dvyukov at google dot com
@ 2012-12-04 13:21 ` jakub at gcc dot gnu.org
  2013-11-19 10:29 ` Joost.VandeVondele at mat dot ethz.ch
  2013-11-19 10:31 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-12-04 13:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55439

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-04 13:20:35 UTC ---
Author: jakub
Date: Tue Dec  4 13:20:20 2012
New Revision: 194133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194133
Log:
    PR sanitizer/55439
    * Makefile.in (tsan.o): Depend on tree-ssa-propagate.h.
    * sanitizer.def: Add __tsan_atomic* builtins.
    * asan.c (initialize_sanitizer_builtins): Adjust to also
    initialize __tsan_atomic* builtins.
    * tsan.c: Include tree-ssa-propagate.h.
    (enum tsan_atomic_action): New enum.
    (tsan_atomic_table): New table.
    (instrument_builtin_call): New function.
    (instrument_gimple): Take pointer to gimple_stmt_iterator
    instead of gimple_stmt_iterator.  Call instrument_builtin_call
    on builtin call stmts.
    (instrument_memory_accesses): Adjust instrument_gimple caller.
    * builtin-types.def (BT_FN_BOOL_VPTR_PTR_I1_INT_INT,
    BT_FN_BOOL_VPTR_PTR_I2_INT_INT, BT_FN_BOOL_VPTR_PTR_I4_INT_INT,
    BT_FN_BOOL_VPTR_PTR_I8_INT_INT, BT_FN_BOOL_VPTR_PTR_I16_INT_INT): New.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/asan.c
    trunk/gcc/builtin-types.def
    trunk/gcc/sanitizer.def
    trunk/gcc/tsan.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug sanitizer/55439] ThreadSanitizer: handle atomic operations
  2012-11-22  7:42 [Bug other/55439] New: ThreadSanitizer: handle atomic operations dvyukov at google dot com
  2012-11-22  7:55 ` [Bug other/55439] " dvyukov at google dot com
  2012-12-04 13:21 ` [Bug sanitizer/55439] " jakub at gcc dot gnu.org
@ 2013-11-19 10:29 ` Joost.VandeVondele at mat dot ethz.ch
  2013-11-19 10:31 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: Joost.VandeVondele at mat dot ethz.ch @ 2013-11-19 10:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55439

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Joost.VandeVondele at mat dot ethz
                   |                            |.ch

--- Comment #3 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
Jakub, your patch went in trunk 1yr ago, should this be closed as fixed ?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug sanitizer/55439] ThreadSanitizer: handle atomic operations
  2012-11-22  7:42 [Bug other/55439] New: ThreadSanitizer: handle atomic operations dvyukov at google dot com
                   ` (2 preceding siblings ...)
  2013-11-19 10:29 ` Joost.VandeVondele at mat dot ethz.ch
@ 2013-11-19 10:31 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-11-19 10:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55439

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
            Version|unknown                     |4.8.0
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-19 10:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  7:42 [Bug other/55439] New: ThreadSanitizer: handle atomic operations dvyukov at google dot com
2012-11-22  7:55 ` [Bug other/55439] " dvyukov at google dot com
2012-12-04 13:21 ` [Bug sanitizer/55439] " jakub at gcc dot gnu.org
2013-11-19 10:29 ` Joost.VandeVondele at mat dot ethz.ch
2013-11-19 10:31 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).