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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:1370014f2ea02ec185cf1199027575916f79fe63

commit r13-6290-g1370014f2ea02ec185cf1199027575916f79fe63
Author: Marek Polacek <pola...@redhat.com>
Date:   Wed Feb 22 15:17:03 2023 -0500

    c-family: avoid compile-time-hog in c_genericize [PR108880]

    This fixes a compile-time hog with UBSan.  This only happened in cc1 but
    not cc1plus.  The problem is ultimately that c_genericize_control_stmt/
    STATEMENT_LIST -> walk_tree_1 doesn't use a hash_set to remember visited
    nodes, so it kept on recursing for a long time.  We should be able to
    use the pset that c_genericize created.  We just need to use walk_tree
    instead of walk_tree_w_d so that the pset is explicit.

            PR c/108880

    gcc/c-family/ChangeLog:

            * c-gimplify.cc (c_genericize_control_stmt) <case STATEMENT_LIST>:
Pass
            pset to walk_tree_1.
            (c_genericize): Call walk_tree with an explicit pset.

    gcc/testsuite/ChangeLog:

            * c-c++-common/ubsan/pr108880.c: New test.

Reply via email to