<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">It seems that the culprit is llvm/unittests/MC/DwarfLineTables.cpp, which has a global variable “Context” that initializes all of LLVM (InitializeAllTargetInfos(), InitializeAllTargetMCs(), InitializeAllDisassemblers(), etc.).<div class=""><br class=""></div><div class="">It seems to have been there forever, but just got uncovered by “luck” (or lack of thereof) by ASAN.</div><div class=""><br class=""></div><div class="">Fixed in r286647 hopefully.</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Nov 11, 2016, at 1:44 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" class="">kcc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Mehdi, Teresa, <div class=""><br class=""></div><div class="">Not sure if this is caused by one of your recent commits, or by someone else's,</div><div class="">please excuse me if that's unrelated to your work... </div><div class=""><br class=""></div><div class=""><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/542/steps/check-llvm%20asan/logs/stdio" class="">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/542/steps/check-llvm%20asan/logs/stdio</a><br class=""></div><div class=""><br class=""></div><div class=""><pre style="font-family: 'courier new', courier, monotype, monospace; font-size: inherit;" class=""><span class="gmail-stdout">==26383==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x000002ef41d8 at pc 0x0000009d1aa5 bp 0x7ffd0cd72b50 sp 0x7ffd0cd72b48
READ of size 4 at 0x000002ef41d8 thread T0
    #0 0x9d1aa4 in getValue /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/CommandLine.h:1229:38
    #1 0x9d1aa4 in operator AsmWriterFlavorTy /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/CommandLine.h:1233
    #2 0x9d1aa4 in llvm::X86ELFMCAsmInfo::X86ELFMCAsmInfo(llvm::Triple const&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp:100
    #3 0x9cf3e1 in createX86MCAsmInfo(llvm::MCRegisterInfo const&, llvm::Triple const&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp:179:15
    #4 0x421020 in createMCAsmInfo /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/TargetRegistry.h:298:12
    #5 0x421020 in Context /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/unittests/MC/DwarfLineTables.cpp:41
    #6 0x421020 in __cxx_global_var_init /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/unittests/MC/DwarfLineTables.cpp:49
    #7 0x421020 in _GLOBAL__sub_I_DwarfLineTables.cpp /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/unittests/MC/DwarfLineTables.cpp
    #8 0x102efcc in __libc_csu_init (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_asan/unittests/MC/MCTests+0x102efcc)
    #9 0x7f57fa3d8ed4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ed4)
    #10 0x4b4222 in _start (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_asan/unittests/MC/MCTests+0x4b4222)

0x000002ef41d8 is located 152 bytes inside of global variable 'AsmWriterFlavor' defined in '/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp:31:1' (0x2ef4140) of size 600
  registered at:
    #0 0x4c63fd in __asan_register_globals.part.15 /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/asan/asan_globals.cc:338
    #1 0x9d3f9b in asan.module_ctor (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_asan/unittests/MC/MCTests+0x9d3f9b)</span></pre><pre style="font-family: 'courier new', courier, monotype, monospace; font-size: inherit;" class=""><span class="gmail-stdout"><br class=""></span></pre>The reports seems correct. </div>The flag object AsmWriterFlavor is used before it is initialized in initialization of some other global object. <div class=""><br class=""></div><div class="">This makes the asan bot red... :( </div><div class=""><br class=""></div><div class="">Thanks, </div><div class="">--kcc</div></div>
</div></blockquote></div><br class=""></div></body></html>