[llvm-commits] [PATCH] report_fatal_error() issue
NAKAMURA Takumi
geek4civic at gmail.com
Tue Feb 1 23:38:27 PST 2011
Dan and all,
raw_fd_ostream::~raw_fd_ostream() is called as global dtors(in atexit handler).
raw_fd_ostream::~raw_fd_ostream() could invoke report_fatal_error().
report_fatal_error() exits by exit(1);
Then global dtors for raw_fd_ostream would be called and might crash.
I propose report_fatal_error() should be suppressed at stderr's error.
On Windows 7(x64), I met this issue. (I have not met on Windows XP)
...Takumi
-------------- next part --------------
From c44b25c543fb9db9df08bcf688420eb81a78bd80 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Mon, 24 Jan 2011 16:02:13 +0900
Subject: [PATCH] lib/Support/raw_ostream.cpp: ErrorHandling.cpp:report_fatal_error() should not be called at dtor context when FD is 2 (stderr).
---
lib/Support/raw_ostream.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index e99c12f..50b0628 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -477,7 +477,7 @@ raw_fd_ostream::~raw_fd_ostream() {
// to avoid report_fatal_error calls should check for errors with
// has_error() and clear the error flag with clear_error() before
// destructing raw_ostream objects which may have errors.
- if (has_error())
+ if (has_error() && FD != 2)
report_fatal_error("IO failure on output stream.");
}
--
1.7.1.GIT
More information about the llvm-commits
mailing list