[llvm-commits] [compiler-rt] r156758 - in /compiler-rt/trunk/lib/tsan/output_tests: mop_with_offset.cc mop_with_offset2.cc
Chandler Carruth
chandlerc at google.com
Mon May 14 07:22:57 PDT 2012
FYI, no need to send out a code review request if you're comfortable
submitting immediately...
On Mon, May 14, 2012 at 7:00 AM, Dmitry Vyukov <dvyukov at google.com> wrote:
> Author: dvyukov
> Date: Mon May 14 09:00:07 2012
> New Revision: 156758
>
> URL: http://llvm.org/viewvc/llvm-project?rev=156758&view=rev
> Log:
> tsan: update output tests to race on heap memory
> Races on stack of main thread are problematic for COMPAT mapping, because
> it's not 1-to-1 and race addr is not properly mapped from shadow back to
> application memory.
> Update output tests to race heap memory.
>
> Modified:
> compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset.cc
> compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset2.cc
>
> Modified: compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset.cc?rev=156758&r1=156757&r2=156758&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset.cc (original)
> +++ compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset.cc Mon May 14
> 09:00:07 2012
> @@ -17,14 +17,15 @@
> }
>
> int main() {
> - int data = 42;
> - fprintf(stderr, "ptr1=%p\n", &data);
> - fprintf(stderr, "ptr2=%p\n", (char*)&data + 2);
> + int *data = new int(42);
> + fprintf(stderr, "ptr1=%p\n", data);
> + fprintf(stderr, "ptr2=%p\n", (char*)data + 2);
> pthread_t t[2];
> - pthread_create(&t[0], NULL, Thread1, &data);
> - pthread_create(&t[1], NULL, Thread2, &data);
> + pthread_create(&t[0], NULL, Thread1, data);
> + pthread_create(&t[1], NULL, Thread2, data);
> pthread_join(t[0], NULL);
> pthread_join(t[1], NULL);
> + delete data;
> }
>
> // CHECK: ptr1=[[PTR1:0x[0-9,a-f]+]]
>
> Modified: compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset2.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset2.cc?rev=156758&r1=156757&r2=156758&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset2.cc (original)
> +++ compiler-rt/trunk/lib/tsan/output_tests/mop_with_offset2.cc Mon May 14
> 09:00:07 2012
> @@ -17,14 +17,15 @@
> }
>
> int main() {
> - int data = 42;
> - fprintf(stderr, "ptr1=%p\n", &data);
> - fprintf(stderr, "ptr2=%p\n", (char*)&data + 2);
> + int *data = new int(42);
> + fprintf(stderr, "ptr1=%p\n", data);
> + fprintf(stderr, "ptr2=%p\n", (char*)data + 2);
> pthread_t t[2];
> - pthread_create(&t[0], NULL, Thread1, &data);
> - pthread_create(&t[1], NULL, Thread2, &data);
> + pthread_create(&t[0], NULL, Thread1, data);
> + pthread_create(&t[1], NULL, Thread2, data);
> pthread_join(t[0], NULL);
> pthread_join(t[1], NULL);
> + delete data;
> }
>
> // CHECK: ptr1=[[PTR1:0x[0-9,a-f]+]]
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120514/55e60a67/attachment.html>
More information about the llvm-commits
mailing list