Here we have forgotten to set the type_pack_expansion_p field of the local variable "ppd" before handing it over to cp_walk_tree / find_parameter_packs_r, which can then read this uninitialized field. This error was spotted when compiling boost under valgrind.
>From what I can tell by the comments and surrounding code, the code always expects TREE_PURPOSE (arg) to be a _TYPE, and it always expects to build a TYPE_PACK_EXPANSION. So I have added an appropriate assert and set type_pack_expansion_p = true. OK after bootstrap and regtest? gcc/cp/ChangeLog: * pt.c (make_pack_expansion): Make sure to initialize ppd.type_pack_expansion_p. --- gcc/cp/pt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 209e65f..dab15bd 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3637,6 +3637,8 @@ make_pack_expansion (tree arg) class expansion. */ ppd.visited = new hash_set<tree>; ppd.parameter_packs = ¶meter_packs; + ppd.type_pack_expansion_p = true; + gcc_assert (TYPE_P (TREE_PURPOSE (arg))); cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r, &ppd, ppd.visited); -- 2.7.0.rc0.50.g1470d8f.dirty