[PATCH] D33960: ErrorHandling: report_fatal_error: call abort() instead of exit()

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 17:06:08 PDT 2017


chandlerc added a comment.

In https://reviews.llvm.org/D33960#864213, @rnk wrote:

> I'm not sure this is a good idea. For years, report_fatal_error outside clang hasn't printed a stack trace or a banner, and that's intentional behavior.


I agree it has been the behavior, but I'm not sure how intentional it has been... =[

> I think the question is, is a report_fatal_error exit indicative of a bug, or is it possibly working as intended? For a long time we've treated it as a valid (but lazy and crappy) way to handle errors in library code. Are we changing that? I could be OK with that as long as its announced. If we want to do this, we should announce it as a new direction for the project on llvm-dev.

I feel like almost every time I have hit `report_fatal_error`, I have wanted it to break in a debugger and potentially provide a stack trace. Maybe I'm weird though.

But I don't see how library code calling `exit(1)` is *ever* going to be a useful error handling mechanism. So I think any place we do this in libraries is either trying to do something like `abort()` (and reasonable) or trying to propagate an error and needs to be fixed pretty badly. Maybe by making it print stack traces and such we will actually be better at going and fixing these issues.

All that said I'm pretty happy asking for somewhat widespread communication of the fact that this is changing. It *is* a change, and we shouldn't paper over that. I just think it is probably the right direction.


Repository:
  rL LLVM

https://reviews.llvm.org/D33960





More information about the llvm-commits mailing list