Commit ffd34392 by Jan Hubicka Committed by Jan Hubicka

class.c (convert_to_base_statically): Fold produced tree; verify that we are not…

class.c (convert_to_base_statically): Fold produced tree; verify that we are not processing template_decl.

	* cp/class.c (convert_to_base_statically): Fold produced tree; verify
	that we are not processing template_decl.

From-SVN: r123711
parent 113008b5
2007-04-11 Jan Hubicka <jh@suse.cz>
* cp/class.c (convert_to_base_statically): Fold produced tree; verify
that we are not processing template_decl.
2007-04-09 Mark Mitchell <mark@codesourcery.com>
PR c++/31449
......
......@@ -531,12 +531,18 @@ convert_to_base_statically (tree expr, tree base)
tree pointer_type;
pointer_type = build_pointer_type (expr_type);
/* We use fold_build2 and fold_convert below to simplify the trees
provided to the optimizers. It is not safe to call these functions
when processing a template because they do not handle C++-specific
trees. */
gcc_assert (!processing_template_decl);
expr = build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1);
if (!integer_zerop (BINFO_OFFSET (base)))
expr = build2 (PLUS_EXPR, pointer_type, expr,
build_nop (pointer_type, BINFO_OFFSET (base)));
expr = build_nop (build_pointer_type (BINFO_TYPE (base)), expr);
expr = build1 (INDIRECT_REF, BINFO_TYPE (base), expr);
expr = fold_build2 (PLUS_EXPR, pointer_type, expr,
fold_convert (pointer_type, BINFO_OFFSET (base)));
expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr);
expr = build_fold_indirect_ref (expr);
}
return expr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment