https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122544

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <[email protected]>:

https://gcc.gnu.org/g:0a2c4b6dd2019d144df49227fce950e10ae62b09

commit r16-5021-g0a2c4b6dd2019d144df49227fce950e10ae62b09
Author: David Malcolm <[email protected]>
Date:   Mon Nov 3 21:42:59 2025 -0500

    analyzer: add event kinds for special control flow [PR122544]

    The SARIF 3.38.8 "kinds" property has some verbs for expressing
    control flow, but is missing some of the awkward special cases.

    The spec says "If none of these values are appropriate, a SARIF
    producer MAY use any value."

    This patch adds the following new values:

    * "throw" for throwing an exception
    * "catch" for catching an exception
    * "unwind" for unwinding stack frame(s) during exception-handling
    * "setjmp" for calls to setjmp
    * "longjmp" for calls to longjmp that rewind the program counter/stack
    to the location of a previous setjmp call

    gcc/analyzer/ChangeLog:
            PR analyzer/122544
            * checker-event.cc (catch_cfg_edge_event::get_meaning): New.
            (setjmp_event::get_meaning): New.
            (rewind_event::get_meaning): New.
            (throw_event::get_meaning): New.
            (unwind_event::get_meaning): New.
            * checker-event.h (catch_cfg_edge_event::get_meaning): New decl.
            (setjmp_event::get_meaning): New decl.
            (rewind_event::get_meaning): New decl.
            (throw_event::get_meaning): New decl.
            (unwind_event::get_meaning): New decl.

    gcc/ChangeLog:
            PR analyzer/122544
            * diagnostics/paths.cc (event::meaning::maybe_get_verb_str):
            Handle the new verbs.
            * diagnostics/paths.h (event::meaning::verb): Add new values
            for special control flow operations.
            (event::meaning::meaning): Add ctor taking just a verb.

    gcc/testsuite/ChangeLog:
            PR analyzer/122544
            * g++.dg/analyzer/exception-path-1-sarif.py: New test script.
            * g++.dg/analyzer/exception-path-1.C: Add SARIF output, and use
            the above to check it.
            * g++.dg/analyzer/exception-path-unwind-multiple-2-sarif.py: New
            test script.
            * g++.dg/analyzer/exception-path-unwind-multiple-2.C: Add SARIF
            output, and use the above to check it.
            * gcc.dg/analyzer/setjmp-3-sarif.py: New test script.
            * gcc.dg/analyzer/setjmp-3.c: Add SARIF output, and use
            the above to check it.

    Signed-off-by: David Malcolm <[email protected]>

Reply via email to