diff options
author | David Malcolm <dmalcolm@redhat.com> | 2021-01-14 17:02:28 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2021-01-14 17:02:28 -0500 |
commit | 387f6c15d303a8f8da508e419fea10a6ef0e2590 (patch) | |
tree | fcf14c994b578c9faaec264b1f7bbb60cf36ec32 /gcc/go | |
parent | 02e7af1122c1aae7c4c764aaa078f72a54645c06 (diff) | |
download | gcc-387f6c15d303a8f8da508e419fea10a6ef0e2590.zip gcc-387f6c15d303a8f8da508e419fea10a6ef0e2590.tar.gz gcc-387f6c15d303a8f8da508e419fea10a6ef0e2590.tar.bz2 |
Handle fancy_abort before diagnostic initialization [PR98586]
If fancy_abort is called before the diagnostic subsystem is initialized,
internal_error will crash internally in a way that prevents a useful
message reaching the user.
This can happen with libgccjit in the case of gcc_assert failures
that occur outside of the libgccjit mutex that guards the rest of
gcc's state, including global_dc (when global_dc may not be
initialized yet, or might be in use by another thread).
I tried a few approaches to fixing this as noted in PR jit/98586
e.g. using a temporary diagnostic_context and initializing it for
the call to internal_error, however the more code that runs, the
more chance there is for other errors to occur.
The best fix appears to be to simply fall back to a minimal abort
implementation that only relies on i18n, as implemented by this
patch.
gcc/ChangeLog:
PR jit/98586
* diagnostic.c (diagnostic_kind_text): Break out this array
from...
(diagnostic_build_prefix): ...here.
(fancy_abort): Detect when diagnostic_initialize has not yet been
called and fall back to a minimal implementation of printing the
ICE, rather than segfaulting in internal_error.
Diffstat (limited to 'gcc/go')
0 files changed, 0 insertions, 0 deletions