http://llvm.org/bugs/show_bug.cgi?id=11373
Bug #: 11373
Summary: stderr/cerr inconsistency between clang and clang++
-std=c++11
Product: clang
Version: trunk
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
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 <iostream>
#include <cassert>
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!
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs