https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125854
--- Comment #6 from Andrew Macleod <amacleod at redhat dot com> --- Created attachment 64762 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64762&action=edit possible patch Yeah, I've got it thanks. Rangers cache is also implemented as another range_query, and functions as a "read-only" propagation of known values. The block filling routine is non-re-entrant in that a cache fill for a name must be completed before another one is issued. that is the assert that is tripping. The problem is the points to code in gimple_fold, when nothing else succeeds, attempts to try folding a statement to see if it resolves to a constant (this is a carry over from what VRP use to do.) The problem is that when this is invoked from the cache's range_query, gimple folding can invoke: gimple_match_range_of_expr (vrange &r, tree op, tree ctx = NULL_TREE) { if (!get_range_query (cfun)->range_of_expr (r, op, ctx ? gimple_match_ctx (ctx) : NULL)) Which is using the current range query... and that in turn ends up spawning new requests from the cache before the old one has finished. The simple solution is to know that match can invoke the current query, and not to try to fold statements if the query being used does not match. Attached patch passes for me, and I'll run it through the testsuite.
