-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 11373 |
| Resolution | FIXED |
| Resolved on | May 12, 2014 00:41 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor,@efriedma-quic |
Extended Description
Hello. I am not sure what component this goes under, but here's the problem: under Linux, clang++ prematurely terminates before cerr has a chance to write, though this does not seem to happen with clang. Below are two examples, the C version that works and C++ analog that does not. Note that I have successfully compiled llvm/clang/clang++/libc++ on my SuSE Linux machine.
clang++ version:
/tools/llvm/bin/clang++ --version
clang version 3.1 (trunk 144502)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang/C program that works:
cat t4.c
#include <stdio.h>
#include <assert.h>
int main(int argc, char* argv[])
{
fprintf(stderr, "Line 1 testing cerr\n");
fprintf(stderr, "Line 2 testing cerr\n");
assert(1 == 0);
return 0;
}
/tools/llvm/bin/clang t4.c -o t4
./t4
Line 1 testing cerr
Line 2 testing cerr
t4: t4.c:7: int main(int, char **): Assertion `1 == 0' failed.
Aborted
clang++/C++11 program that does not work:
cat t3.cpp
#include
#include
using namespace std;
int main(int argc, char* argv[])
{
cerr << "Line 1 testing cerr" << endl;
cerr << "Line 2 testing cerr" << endl;
assert(true == false);
return 0;
}
/tools/llvm/bin/clang++ -std=c++11 -stdlib=libc++ t3.cpp -o t3
./t3
Line 1 testing cerrAborted
Note how Line 2 never gets printed. My understanding what that cerr is not buffered so it should print both lines before the assertion terminates the program, right?
I would be grateful for any information that would resolve this problem. Many thanks!