diff options
author | Marek Polacek <polacek@redhat.com> | 2023-02-22 15:17:03 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2023-02-22 17:26:29 -0500 |
commit | 1370014f2ea02ec185cf1199027575916f79fe63 (patch) | |
tree | a0f682e9c3913f1dd46f5976721757e55f088891 /libcc1/callbacks.cc | |
parent | 31303c9b5bab200754cdb7ef8cd91ae4918f3018 (diff) | |
download | gcc-1370014f2ea02ec185cf1199027575916f79fe63.zip gcc-1370014f2ea02ec185cf1199027575916f79fe63.tar.gz gcc-1370014f2ea02ec185cf1199027575916f79fe63.tar.bz2 |
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.
Diffstat (limited to 'libcc1/callbacks.cc')
0 files changed, 0 insertions, 0 deletions