From: Jakub Jelinek Date: Thu, 19 Mar 2015 07:55:22 +0000 (+0100) Subject: re PR sanitizer/64265 (r217669 broke tsan) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=02703f4c0fef1a978c555ebf1abe9c4760164a7d;p=gcc.git re PR sanitizer/64265 (r217669 broke tsan) PR sanitizer/64265 * g++.dg/tsan/pr64265.C: New test. From-SVN: r221509 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 405eaebf130..756baf3847e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2015-03-19 Jakub Jelinek + PR sanitizer/64265 + * g++.dg/tsan/pr64265.C: New test. + PR sanitizer/65400 * c-c++-common/tsan/pr65400-1.c: New test. * c-c++-common/tsan/pr65400-2.c: New test. diff --git a/gcc/testsuite/g++.dg/tsan/pr64265.C b/gcc/testsuite/g++.dg/tsan/pr64265.C new file mode 100644 index 00000000000..fde32e7d0c0 --- /dev/null +++ b/gcc/testsuite/g++.dg/tsan/pr64265.C @@ -0,0 +1,54 @@ +// PR sanitizer/64265 +// { dg-shouldfail "tsan" } +// { dg-additional-options "-fno-omit-frame-pointer -ldl" } + +#include +#include "tsan_barrier.h" + +static pthread_barrier_t barrier; +int v; + +__attribute__((noinline, noclone)) int +foo (int x) +{ + if (x < 99) + throw x; + barrier_wait (&barrier); + v++; + return x; +} + +__attribute__((noinline, noclone)) void +bar (void) +{ + for (int i = 0; i < 100; i++) + try + { + foo (i); + } + catch (int) + { + } +} + +__attribute__((noinline, noclone)) void * +tf (void *) +{ + bar (); + return NULL; +} + +int +main () +{ + pthread_t th; + barrier_init (&barrier, 2); + if (pthread_create (&th, NULL, tf, NULL)) + return 0; + v++; + barrier_wait (&barrier); + pthread_join (th, NULL); + return 0; +} + +// { dg-output "WARNING: ThreadSanitizer: data race.*#2 _?(tf|_Z2tfPv)" }