Commit dc500fa1 by Richard Kenner

(expand_expr, case PLACEHOLDER_EXPR): Refine which object is picked.

From-SVN: r13718
parent ab162578
...@@ -5100,22 +5100,33 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5100,22 +5100,33 @@ expand_expr (exp, target, tmode, modifier)
further information, see tree.def. */ further information, see tree.def. */
if (placeholder_list) if (placeholder_list)
{ {
tree object; tree need_type = TYPE_MAIN_VARIANT (type);
tree object = 0;
tree old_list = placeholder_list; tree old_list = placeholder_list;
tree elt;
for (object = TREE_PURPOSE (placeholder_list); /* See if the object is the type that we want. Then see if
(TYPE_MAIN_VARIANT (TREE_TYPE (object)) the operand of any reference is the type we want. */
!= TYPE_MAIN_VARIANT (type)) if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_PURPOSE (placeholder_list)))
&& (TREE_CODE_CLASS (TREE_CODE (object)) == 'r' == need_type))
|| TREE_CODE_CLASS (TREE_CODE (object)) == '1' object = TREE_PURPOSE (placeholder_list);
|| TREE_CODE_CLASS (TREE_CODE (object)) == '2'
|| TREE_CODE_CLASS (TREE_CODE (object)) == 'e'); /* Find the innermost reference that is of the type we want. */
object = TREE_OPERAND (object, 0)) for (elt = TREE_PURPOSE (placeholder_list);
; elt != 0
&& (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
if (object != 0 || TREE_CODE_CLASS (TREE_CODE (elt)) == '1'
&& (TYPE_MAIN_VARIANT (TREE_TYPE (object)) || TREE_CODE_CLASS (TREE_CODE (elt)) == '2'
== TYPE_MAIN_VARIANT (type))) || TREE_CODE_CLASS (TREE_CODE (elt)) == 'e');
elt = ((TREE_CODE (elt) == COMPOUND_EXPR
|| TREE_CODE (elt) == COND_EXPR)
? TREE_OPERAND (elt, 1) : TREE_OPERAND (elt, 0)))
if (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (elt, 0)))
== need_type))
object = TREE_OPERAND (elt, 0);
if (object != 0)
{ {
/* Expand this object skipping the list entries before /* Expand this object skipping the list entries before
it was found in case it is also a PLACEHOLDER_EXPR. it was found in case it is also a PLACEHOLDER_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