|
From: Bart V. A. <bva...@ac...> - 2011-07-13 10:21:43
|
On Tue, Jul 12, 2011 at 10:13 PM, Azat Khuzhin <doh...@gm...> wrote: > And now, set s_enable_annotations to false: > sed -e 's/static bool s_enable_annotations = true/static bool > s_enable_annotations = false/' drd/tests/annotate_smart_pointer.cpp > > drd/tests/annotate_smart_pointer_wrong.cpp Hello Azat, I'm afraid you have missed the third line in main(): s_enable_annotations = argc > 3 ? !!atoi(argv[3]) : true; So no matter which value is assigned to s_enable_annotations in the line you modified, that value is overridden by the function main(). Or: the program generated by the above sed script will run with annotations enabled, unless it is started with a third argument that is zero. The output below shows that with annotations disabled a race *is* reported: $ ./vg-in-place --tool=drd --show-confl-seg=no drd/tests/annotate_smart_pointer 1 1 0 ==3083== drd, a thread error detector ==3083== Copyright (C) 2006-2011, and GNU GPL'd, by Bart Van Assche. ==3083== Using Valgrind-3.7.0.SVN and LibVEX; rerun with -h for copyright info ==3083== Command: drd/tests/annotate_smart_pointer 1 1 0 ==3083== ==3083== Conflicting store by thread 1 at 0x0432d030 size 4 ==3083== at 0x8048F22: main (annotate_smart_pointer.cpp:273) ==3083== Address 0x432d030 is at offset 24 from 0x432d018. Allocation context: ==3083== at 0x402B44D: operator new(unsigned int) (vg_replace_malloc.c:252) ==3083== by 0x8048D6B: main (annotate_smart_pointer.cpp:316) ==3083== Done. ==3083== ==3083== For counts of detected and suppressed errors, rerun with: -v ==3083== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 18 from 6) Further feedback is welcome though. Bart. |