https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82115
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |nathan at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Anyway, if value_dependent_expression_p needs to recurse on DECL_INITIAL that can contain arbitrary stuff, including the VAR_DECL with that DECL_INITIAL in it, we need to avoid the recursion. "it is a constant with literal type and is initialized with an expression that is value-dependent." is what applies here. So do we need some hash-map that will track VAR_DECLs on whose DECL_INITIAL we've already recursed? The problem is that value_dependent_expression_p calls type_dependent_expression_p and vice versa, so it is unclear when that hash-map should be saved/restored. Even if it is not possible to reach similar infinite recursion through both of those functions (i.e. when we could save/restore the hash-map in "toplevel" value_dependent_expression_p call and use value_dependent_expression_p_1 recursing to itself from it, another question is how to do that efficiently; how common are VAR_DECLs on which we recurse on DECL_INITIAL? How many there are on average during one top-level value_dependent_expression_p call? E.g. if the common cases are 0 or 1 times, perhaps we could have next to the hash-map a single tree which we'd compare and only create hash-map if seeing another one.