https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99447
--- Comment #18 from Jan Hubicka <hubicka at gcc dot gnu.org> --- > Looking around the only place (we don't know whether this was WPA or LTRANS) > we'd have a cgraph with edges is during clone materialization which pointed > me at cgraph_node::release_body which frees the body but fails to eventually > zap ->call_stmt references This I agree with, but during our last discussion I went through all release_body calls and found none which would match this scenario - they are all on paths where we zap cgraph edges to (it is only makes sense to exist in this case, since we are supposed to keep cgrpah edges in sync with actual body and after feeing the body this would leave cgaph in inconsistent stage). I will try to move tree to 20210306 and see if that helps. I can simply add cgraph edge removal to release_body to make code bit more robust - while most uses erases edges earlier, it is almost free to check the pointer for being NULL twice. Still it is weird that the bug does not reproduce with allways collect.