[llvm-commits] [PATCH] report_fatal_error() issue

NAKAMURA Takumi geek4civic at gmail.com
Wed Feb 2 17:22:57 PST 2011


Dan, thank you to comment me!

I met this issue with test/Others/close-stderr.ll on mingw MSYS bash shell.

2011/2/3 Dan Gohman <gohman at apple.com>:
> If there's a real bug here, please explain it.  Otherwise, this seems to be
> some Windows quirk, so it should be conditionalized with #if accordingly.
>  In either case, please add a comment in the code.

I was dubious to invoke exit() in global dtors.
I have reconfirmed "exit() in global dtor" works on glibc2 linux.
I have to conditionalize when we can expect it above. eg.
#ifdef __MINGW32__
  // Mingw is not expected to call exit() in dtor context.
  return;
#endif
  if (has_error()) report_fatal_error(...);

On mingw, global dtors are called as atexit handlers. (not cxa_atexit)
And it seems atexit() would not be re-entrant.

Anyway I thought report_fatal_error() would be futile when stderr got
fault (FD == 2).

...Takumi




More information about the llvm-commits mailing list