diff options
| author | Reid Kleckner <reid@kleckner.net> | 2014-06-05 00:13:43 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2014-06-05 00:13:43 +0000 |
| commit | c19e37e1764ce3e77c474370484e525fbc87e12b (patch) | |
| tree | 8b7e64e2e8c55c5cde5cedb921b912303fca1ab0 /lib/CodeGen/CGExpr.cpp | |
| parent | bb97c3d5d0ba5f811b4671b98ee10909b79df542 (diff) | |
| download | clang-c19e37e1764ce3e77c474370484e525fbc87e12b.tar.gz clang-c19e37e1764ce3e77c474370484e525fbc87e12b.tar.bz2 clang-c19e37e1764ce3e77c474370484e525fbc87e12b.tar.xz | |
Flush C stdio streams upon process termination
Due to what can only be described as a CRT bug, stdout and amazingly
even stderr are not always flushed upon process termination, especially
when the system is under high threading pressure. I have found two
repros for this:
1) In lib\Support\Threading.cpp, change sys::Mutex to an
std::recursive_mutex and run check-clang. Usually between 30 and 40
tests will fail.
2) Add OutputDebugStrings in code that runs during static initialization
and static shutdown. This will sometimes generate similar failures.
After a substantial amount of troubleshooting and debugging, I found
that I could reproduce this from the command line without running
check-clang. Simply make the mutex change described in #1, then
manually run the following command many times by running it once, then
pressing Up -> Enter very quickly:
D:\src\llvm\build\vs2013\Debug\bin\c-index-test.EXE -cursor-at=D:\src\llvm\tools\clang\test\Index\targeted-preamble.h:2:15 D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -include D:\src\llvm\build\vs2013\tools\clang\test\Index\Output\targeted-cursor.c.tmp.h -Xclang -error-on-deserialized-decl=NestedVar1 -Xclang -error-on-deserialized-decl=TopVar | D:\src\llvm\build\vs2013\Debug\bin\FileCheck.EXE D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -check-prefix=PREAMBLE-CURSOR1
Sporadically they will fail, and attaching a debugger to a failed
instance indicates that stdin of FileCheck.exe is empty.
Note that due to the repro in #2, we can rule out a bug in the STL's
mutex implementation, and instead conclude that this is a real flake in
the windows test harness.
Test Plan:
Without patch: Ran check-clang 10 times and saw over 30 Unexpected failures on every run.
With patch: Ran check-clang 10 times and saw 0 unexpected failures across all runs.
Reviewers: rnk
Differential Revision: http://reviews.llvm.org/D4021
Patch by Zachary Turner!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210225 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
0 files changed, 0 insertions, 0 deletions
