[LLVMbugs] [Bug 7043] New: Clang error handling crashes following LLVM stream error (in teardown)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 4 12:08:17 PDT 2010


           Summary: Clang error handling crashes following LLVM stream
                    error (in teardown)
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dgregor at apple.com
                CC: llvmbugs at cs.uiuc.edu

I haven't found a way to reproduce this outside of Boost's build system, but
the issue here is that, if an error occurs during the destruction of the
standard output or standard error stream objects (raw_stderr_ostream,
raw_stdout_ostream), that error will be passed up to the Clang diagnostic
system... which has already been destroyed by this point. We should report
errors during teardown directly to standard error, ignoring the LLVM error
handler and without using llvm::errs(), whose destruction might cause the

Here's a stack trace I was able to capture when this problem occurred:

#0  0x00007fff855f0886 in __kill ()
#1  0x00007fff85690eae in abort ()
#2  0x00007fff805a35d2 in __gnu_cxx::__verbose_terminate_handler ()
#3  0x00007fff805a1ae1 in __cxxabiv1::__terminate ()
#4  0x00007fff805a1b16 in std::terminate ()
#5  0x00007fff805a1fd6 in __cxa_pure_virtual ()
#6  0x00000001001e1180 in llvm::raw_ostream::tell (this=0x10231a990) at
#7  0x00000001001db99e in clang::TextDiagnosticPrinter::HandleDiagnostic
(this=0x104b08700, Level=Fatal, Info=@0x7fff5fbfed78) at
#8  0x0000000100adb3e5 in clang::Diagnostic::ProcessDiag (this=0x104b08500) at
#9  0x0000000100adb499 in clang::DiagnosticBuilder::Emit (this=0x7fff5fbfee30)
at Diagnostic.cpp:603
#10 0x0000000100050788 in clang::DiagnosticBuilder::~DiagnosticBuilder
(this=0x7fff5fbfee30) at Diagnostic.h:648
#11 0x0000000100049dd8 in clang::DiagnosticBuilder::~DiagnosticBuilder
(this=0x7fff5fbfee30) at Diagnostic.h:648
#12 0x00000001000479d2 in LLVMErrorHandler (UserData=0x104b08500,
Message=@0x7fff5fbfee90) at cc1_main.cpp:49
#13 0x00000001016ddc7d in llvm::report_fatal_error (reason=@0x7fff5fbfeec0) at
#14 0x00000001016ddbec in llvm::report_fatal_error (reason=0x1018c3410 "IO
failure on output stream.") at ErrorHandling.cpp:42
#15 0x0000000101700a85 in llvm::raw_ostream::~raw_ostream (this=0x10231a990) at
#16 0x0000000101701565 in llvm::raw_fd_ostream::~raw_fd_ostream
(this=0x10231a990) at raw_ostream.cpp:417
#17 0x0000000101702947 in llvm::raw_stderr_ostream::~raw_stderr_ostream
(this=0x10231a990) at raw_ostream.h:394
#18 0x0000000101702740 in llvm::raw_stderr_ostream::~raw_stderr_ostream
(this=0x10231a990) at raw_ostream.h:394
#19 0x00007fff855b4c58 in __cxa_finalize ()
#20 0x00007fff855b4b70 in exit ()
#21 0x000000010003fe9b in start () at TimeValue.cpp:47

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.

More information about the llvm-bugs mailing list