https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103122
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Macleod <amacl...@gcc.gnu.org>: https://gcc.gnu.org/g:0cd653bd2559701da9cc4c9bf51f22bdd68623b5 commit r12-5006-g0cd653bd2559701da9cc4c9bf51f22bdd68623b5 Author: Andrew MacLeod <amacl...@redhat.com> Date: Mon Nov 8 09:32:42 2021 -0500 Don't calculate new values when using the private context callback. When using rangers private callback mechanism to provide context to fold_stmt calls, we are only suppose to be using the cache in read only mode, never calculate new values. gcc/ PR tree-optimization/103122 * gimple-range.cc (gimple_ranger::range_of_expr): Request the cache entry with "calulate new values" set to false. gcc/testsuite/ * g++.dg/pr103122.C: New.