<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87345>87345</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Test asan\TestCases\init-order-atexit.cpp fails on windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
compiler-rt:asan
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tru
</td>
</tr>
</table>
<pre>
This test fails on Windows with the following output:
Tested this on latest 18.x release.
```
FAIL: AddressSanitizer-x86_64-windows :: TestCases/init-order-atexit.cpp (1 of 1)
******************** TEST 'AddressSanitizer-x86_64-windows :: TestCases/init-order-atexit.cpp' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 7
C:/code/llvm/llvm.packageci/build/llvm-final-windows/./bin/clang.exe -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -gcodeview -gcolumn-info -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O0 C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases/Helpers/init-order-atexit-extra.cpp -o c:\code\llvm\llvm.packageci\build\llvm-final-windows\runtimes\runtimes-x86_64-pc-windows-msvc-bins\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Output\init-order-atexit.cpp.tmp
# executed command: C:/code/llvm/llvm.packageci/build/llvm-final-windows/./bin/clang.exe -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -gcodeview -gcolumn-info -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O0 'C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp' 'C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases/Helpers/init-order-atexit-extra.cpp' -o 'c:\code\llvm\llvm.packageci\build\llvm-final-windows\runtimes\runtimes-x86_64-pc-windows-msvc-bins\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Output\init-order-atexit.cpp.tmp'
# RUN: at line 8
env ASAN_OPTIONS=strict_init_order=true not c:\code\llvm\llvm.packageci\build\llvm-final-windows\runtimes\runtimes-x86_64-pc-windows-msvc-bins\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Output\init-order-atexit.cpp.tmp 2>&1 | FileCheck C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp
# executed command: env ASAN_OPTIONS=strict_init_order=true not 'c:\code\llvm\llvm.packageci\build\llvm-final-windows\runtimes\runtimes-x86_64-pc-windows-msvc-bins\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\Output\init-order-atexit.cpp.tmp'
# executed command: FileCheck 'C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp'
# .---command stderr------------
# | C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp:23:12: error: CHECK: expected string not found in input
# | // CHECK: PASSED
# | ^
# | <stdin>:1:1: note: scanning from here
# | =================================================================
# | ^
# | <stdin>:21:33: note: possible intended match here
# | #17 0x7ff986f0aa57 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x18005aa57)
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | 1: =================================================================
# | check:23'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | 2: ==14380==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x7ff7cc091ae0 at pc 0x7ff7cb692352 bp 0x0015ff51f470 sp 0x0015ff51f4b8
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 3: READ of size 4 at 0x7ff7cc091ae0 thread T0
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 4: #0 0x7ff7cb692351 in AccessC(void) C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\Helpers\init-order-atexit-extra.cpp:13:29
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 5: #1 0x7ff7cb691fea in A::~A(void) C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp:21:10
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 6: #2 0x7ff7cb691f05 in `dynamic atexit destructor for 'a' C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp:26
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | .
# | .
# | .
# | 16: #12 0x7ff7cb691f25 in `dynamic initializer for 'b' C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp:34:3
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 17: #13 0x7ff7cb691f7f in _GLOBAL__sub_I_init_order_atexit.cpp C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases\init-order-atexit.cpp
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 18: #14 0x7ff7cb6b114e in _initterm c:\code\llvm\llvm.packageci\build\llvm-final-windows\runtimes\runtimes-x86_64-pc-windows-msvc-bins\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp:21
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 19: #15 0x7ff7cb693178 in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:256
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 20: #16 0x7ff98667257c (C:\WINDOWS\System32\KERNEL32.DLL+0x18001257c)
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 21: #17 0x7ff986f0aa57 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x18005aa57)
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:23'1 ? possible intended match
# | 22:
# | check:23'0 ~
# | 23: 0x7ff7cc091ae0 is located 0 bytes inside of global variable 'class C c' defined in 'C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\test\asan\TestCases/Helpers/init-order-atexit-extra.cpp' (0x7ff7cc091ae0) of size 4
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 24: registered at:
# | check:23'0 ~~~~~~~~~~~~~~~~
# | 25: #0 0x7ff7cb67e64b in __asan_register_globals C:\code\llvm\llvm.packageci\git\llvm-project\compiler-rt\lib\asan\asan_globals.cpp:369
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 26: #1 0x7ff7cb6b114e in _initterm c:\code\llvm\llvm.packageci\build\llvm-final-windows\runtimes\runtimes-x86_64-pc-windows-msvc-bins\compiler-rt\test\asan\X86_64WindowsConfig\TestCases\minkernel\crts\ucrt\src\appcrt\startup\initterm.cpp:21
# | check:23'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | .
# | .
# | .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
--
********************
Testing: 0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
********************
Failed Tests (1):
AddressSanitizer-x86_64-windows :: TestCases/init-order-atexit.cpp
Testing Time: 2.04s
Total Discovered Tests: 1
Failed: 1 (100.00%)
```
I see that this test is disabled on mingw, but with no real context. Should this be disabled on all windows targets?
@mstorsjo @sylvain-audi
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWl9z4ygS_zTkpUsqCVmW_ZAHj__cpjY32UpyNXtPLiS1bHYQuAAlzjzsZ78C-X_sbO7GM5nsDeUQS0LQ_ft1N9CGGcNnEvGSpB9IOrpgjZ0rfWl1c5Gr8unyfs4NWDQWKsaFASXhE5elejTwyO0c7ByhUkKoRy5noBq7aCxJBiQakWhV36OxWIJ1PSkJgvnu4l64BI0CmcFwtznpRquPv5wMrq5JMoBBWWo05o5JbvkX1MGy1512O8HjSho3aDIAN9iQGTSETrjkNlC6RB0wi0tuw2KxAEJ7MagKYkL7qxHp__6B-_HdPRCanUs-QjNwOo9H8DVytZqNl9zCUJXoho53UR6qumayhBvPmAPF2FI11oGypi8I1vgkcPuvj64PZkFwiZCtenFt6aRwI9CJ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