https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94886
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>: https://gcc.gnu.org/g:448c89d590455ed4ab7abc40309b5cf8ec52d13d commit r10-8075-g448c89d590455ed4ab7abc40309b5cf8ec52d13d Author: Iain Sandoe <i...@sandoe.co.uk> Date: Thu Apr 30 10:42:36 2020 +0100 coroutines: Fix handling of artificial vars [PR94886] The testcase ICEs because the range-based for generates three artificial variables that need to be allocated to the coroutine frame but, when walking the BIND_EXR that contains these, the DECL_INITIAL for one of them refers to an entry appearing later, which means that the frame entry hasn't been allocated when that INITIAL is walked. The solution is to defer walking the DECL_INITIAL/SIZE etc. until all the BIND_EXPR vars have been processed. gcc/cp/ChangeLog: 2020-04-30 Iain Sandoe <i...@sandoe.co.uk> PR c++/94886 * coroutines.cc (transform_local_var_uses): Defer walking the DECL_INITIALs of BIND_EXPR vars until all the frame allocations have been made. gcc/testsuite/ChangeLog: 2020-04-30 Iain Sandoe <i...@sandoe.co.uk> PR c++/94886 * g++.dg/coroutines/pr94886-folly-3.C: New test.