aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.cc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-10-12 15:58:05 -0400
committerMarek Polacek <polacek@redhat.com>2023-10-17 17:41:44 -0400
commit765c3b8f82d50961008c214ac2113f35e7532aa9 (patch)
tree7db78233c62877764f7da71812e9f8218d372739 /gcc/function.cc
parentbac21b7ea62bd3a7911e01cf803d6bf6516fbf7b (diff)
downloadgcc-765c3b8f82d50961008c214ac2113f35e7532aa9.zip
gcc-765c3b8f82d50961008c214ac2113f35e7532aa9.tar.gz
gcc-765c3b8f82d50961008c214ac2113f35e7532aa9.tar.bz2
c++: Fix compile-time-hog in cp_fold_immediate_r [PR111660]
My recent patch introducing cp_fold_immediate_r caused exponential compile time with nested COND_EXPRs. The problem is that the COND_EXPR case recursively walks the arms of a COND_EXPR, but after processing both arms it doesn't end the walk; it proceeds to walk the sub-expressions of the outermost COND_EXPR, triggering again walking the arms of the nested COND_EXPR, and so on. This patch brings the compile time down to about 0m0.030s. The ff_fold_immediate flag is unused after this patch but since I'm using it in the P2564 patch, I'm not removing it now. Maybe at_eof can be used instead and then we can remove ff_fold_immediate. PR c++/111660 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold_immediate_r) <case COND_EXPR>: Don't handle it here. (cp_fold_r): Handle COND_EXPR here. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/hog1.C: New test. * g++.dg/cpp2a/consteval36.C: New test.
Diffstat (limited to 'gcc/function.cc')
0 files changed, 0 insertions, 0 deletions