<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Feb 2, 2011, at 5:22 PM, NAKAMURA Takumi wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dan, thank you to comment me!<br><br>I met this issue with test/Others/close-stderr.ll on mingw MSYS bash shell.<br><br>2011/2/3 Dan Gohman <<a href="mailto:gohman@apple.com">gohman@apple.com</a>>:<br><blockquote type="cite">If there's a real bug here, please explain it.  Otherwise, this seems to be<br></blockquote><blockquote type="cite">some Windows quirk, so it should be conditionalized with #if accordingly.<br></blockquote><blockquote type="cite"> In either case, please add a comment in the code.<br></blockquote><br>I was dubious to invoke exit() in global dtors.<br>I have reconfirmed "exit() in global dtor" works on glibc2 linux.<br></div></blockquote><div><br></div><div>With the current code, output errors in raw_fd_ostream never pass</div><div>silently, unless explicitly silenced. If you know of a better way to</div><div>achieve this, please suggest it.</div></div><div><br><blockquote type="cite"><div>I have to conditionalize when we can expect it above. eg.<br>#ifdef __MINGW32__<br>  // Mingw is not expected to call exit() in dtor context.<br>  return;<br>#endif<br>  if (has_error()) report_fatal_error(…);<br></div></blockquote><div><br></div><div>With this approach, command-line tools like opt, llc, etc., will</div><div>silently swallow all output errors on mingw. I'll leave it up to you.</div><div><br></div><blockquote type="cite"><div>On mingw, global dtors are called as atexit handlers. (not cxa_atexit)<br>And it seems atexit() would not be re-entrant.<br><br>Anyway I thought report_fatal_error() would be futile when stderr got<br>fault (FD == 2).<br></div></blockquote></div><div><br></div><div>If stderr has seen an output error, something bad must have happened.</div><div>Even though report_fatal_error's own message may not get through, its</div><div>other effects are still useful.</div><br><div>Dan</div><div><br></div></body></html>