https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65515
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is from: 644 else if (TREE_CODE (expr) == FUNCTION_TYPE 645 || TREE_CODE (expr) == METHOD_TYPE) 646 DFS_follow_tree_edge (TYPE_ARG_TYPES (expr)); where TYPE_ARG_TYPES contains a huge TREE_LIST chain (100001 TREE_LIST nodes). >From quick look at DFS::DFS_write_tree and DFS::DFS_write_tree_body, we don't really have anything there like GTY chain_next, which is clearly highly desirable here. Dunno if order matters here, if not, then for TS_LIST counting number of elements and if it is longer than say 10 or 100, use the vector + DFS_write_node from the end to start, could work.