https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71330
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Mon Jun 6 20:11:54 2016 New Revision: 237152 URL: https://gcc.gnu.org/viewcvs?rev=237152&root=gcc&view=rev Log: PR c++/70847 PR c++/71330 PR c++/71393 * cp-gimplify.c (cp_fold_r): Set *walk_subtrees = 0 and return NULL right after cp_fold call if cp_fold has returned the same stmt already in some earlier cp_fold_r call. (cp_fold_function): Add pset automatic variable, pass its address to cp_walk_tree. * g++.dg/opt/pr70847.C: New test. * g++.dg/ubsan/pr70847.C: New test. * g++.dg/ubsan/pr71393.C: New test. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/opt/pr70847.C branches/gcc-6-branch/gcc/testsuite/g++.dg/ubsan/pr70847.C branches/gcc-6-branch/gcc/testsuite/g++.dg/ubsan/pr71393.C Modified: branches/gcc-6-branch/gcc/cp/ChangeLog branches/gcc-6-branch/gcc/cp/cp-gimplify.c branches/gcc-6-branch/gcc/testsuite/ChangeLog