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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:23b4ce18379cd336d99d7c71701be28118905b57

commit r13-5112-g23b4ce18379cd336d99d7c71701be28118905b57
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Wed Jan 11 22:18:42 2023 +0100

    c: Don't emit DEBUG_BEGIN_STMTs for K&R function argument declarations
[PR105972]

    K&R function parameter declarations are handled by calling
    recursively c_parser_declaration_or_fndef in a loop, where each such
    call will add_debug_begin_stmt at the start.
    Now, if the K&R function definition is not a nested function,
    building_stmt_list_p () is false and so we don't emit the DEBUG_BEGIN_STMTs
    anywhere, but if it is a nested function, we emit it in the containing
    function at the point of the nested function definition.
    As the following testcase shows, it can cause ICEs if the containing
    function has var-tracking disabled but nested function has them enabled,
    as the DEBUG_BEGIN_STMTs are added to the containing function which
    shouldn't have them but MAY_HAVE_DEBUG_MARKER_STMTS is checked already
    for the nested function, or just wrong experience in the debugger.

    The following patch ensures we don't emit any such DEBUG_BEGIN_STMTs for
the
    K&R function parameter declarations even in nested functions.

    2023-01-11  Jakub Jelinek  <ja...@redhat.com>

            PR c/105972
            * c-parser.cc (c_parser_declaration_or_fndef): Disable debug
non-bind
            markers for K&R function parameter declarations of nested
functions.

            * gcc.dg/pr105972.c: New test.

Reply via email to