diff options
author | David Malcolm <dmalcolm@redhat.com> | 2025-09-12 10:24:36 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2025-09-12 10:24:36 -0400 |
commit | 38cb4289180d13a71c2e1005223f442747bcf56e (patch) | |
tree | 7a906fc5f18ecf0f97777194af47c43145e5d571 /libjava | |
parent | 85a97e1a8ee934f46b89958b8374dd880dd489a4 (diff) | |
download | gcc-38cb4289180d13a71c2e1005223f442747bcf56e.zip gcc-38cb4289180d13a71c2e1005223f442747bcf56e.tar.gz gcc-38cb4289180d13a71c2e1005223f442747bcf56e.tar.bz2 |
diagnostics: fix crash-handling inside nested diagnostics [PR121876]
PR diagnostics/121876 tracks an issue inside our crash-handling, where
if an ICE happens when we're within a nested diagnostic, an assertion
fails inside diagnostic::context::set_diagnostic_buffer, leading to
a 2nd ICE. Happily, this does not infinitely recurse, but it obscures
the original ICE and the useful part of the backtrace, and any SARIF or
HTML sinks we were writing to are left as empty files.
This patch tweaks the above so that the assertion doesn't fail, and adds
test coverage (via a plugin) to ensure that such ICEs/crashes are
gracefully handled and e.g. captured in SARIF/HTML output.
gcc/ChangeLog:
PR diagnostics/121876
* diagnostics/buffering.cc (context::set_diagnostic_buffer): Add
early reject of the no-op case.
gcc/testsuite/ChangeLog:
PR diagnostics/121876
* gcc.dg/plugin/crash-test-nested-ice-html.py: New test.
* gcc.dg/plugin/crash-test-nested-ice-sarif.py: New test.
* gcc.dg/plugin/crash-test-nested-ice.c: New test.
* gcc.dg/plugin/crash-test-nested-write-through-null-html.py: New test.
* gcc.dg/plugin/crash-test-nested-write-through-null-sarif.py: New test.
* gcc.dg/plugin/crash-test-nested-write-through-null.c: New test.
* gcc.dg/plugin/crash_test_plugin.cc: Add "nested" argument, and when
set, inject the problem within a nested diagnostic.
* gcc.dg/plugin/plugin.exp: Add crash-test-nested-ice.c and
crash-test-nested-write-through-null.c.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'libjava')
0 files changed, 0 insertions, 0 deletions