[PATCH] [Tsan] Fix the global_race tests to pass on FreeBSD

Viktor Kutuzov vkutuzov at accesssoftek.com
Wed Oct 8 05:18:20 PDT 2014

Hi kcc, samsonov, glider,

On FreeBSD the libc's %p conversion specifier outputs the pointer value in 0x%x format, that is, without any leading zeros. In contrast, on Linux that specifier works as 0x%012x what matches the RTL's implementation of formatted output:

  static int AppendPointer(char **buff, const char *buff_end, u64 ptr_value) {
    int result = 0;
    result += AppendString(buff, buff_end, -1, "0x");
    result += AppendUnsigned(buff, buff_end, ptr_value, 16,
                             (SANITIZER_WORDSIZE == 64) ? 12 : 8, true);
    return result;

As soon as Tsan relies on that code for generating diagnostic messages, it looks the test cases should generate pointer values in this specific format as well and should not assume it matches to what %p would produce.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5668.14563.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141008/54307232/attachment.bin>

More information about the llvm-commits mailing list