aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1997-03-16 19:54:36 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1997-03-16 19:54:36 -0500
commitdc500fa1152297244eb8ecfa102c54779b725a16 (patch)
treeb90953c712ca9f250676af9462c5c9bc516773ea /gcc
parentab16257805b6614e1ad674b29965a9faca5511bd (diff)
downloadgcc-dc500fa1152297244eb8ecfa102c54779b725a16.zip
gcc-dc500fa1152297244eb8ecfa102c54779b725a16.tar.gz
gcc-dc500fa1152297244eb8ecfa102c54779b725a16.tar.bz2
(expand_expr, case PLACEHOLDER_EXPR): Refine which object is picked.
From-SVN: r13718
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index dfe1b4f..5e5cb10 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5100,22 +5100,33 @@ expand_expr (exp, target, tmode, modifier)
further information, see tree.def. */
if (placeholder_list)
{
- tree object;
+ tree need_type = TYPE_MAIN_VARIANT (type);
+ tree object = 0;
tree old_list = placeholder_list;
+ tree elt;
- for (object = TREE_PURPOSE (placeholder_list);
- (TYPE_MAIN_VARIANT (TREE_TYPE (object))
- != TYPE_MAIN_VARIANT (type))
- && (TREE_CODE_CLASS (TREE_CODE (object)) == 'r'
- || TREE_CODE_CLASS (TREE_CODE (object)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (object)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (object)) == 'e');
- object = TREE_OPERAND (object, 0))
- ;
-
- if (object != 0
- && (TYPE_MAIN_VARIANT (TREE_TYPE (object))
- == TYPE_MAIN_VARIANT (type)))
+ /* See if the object is the type that we want. Then see if
+ the operand of any reference is the type we want. */
+ if ((TYPE_MAIN_VARIANT (TREE_TYPE (TREE_PURPOSE (placeholder_list)))
+ == need_type))
+ object = TREE_PURPOSE (placeholder_list);
+
+ /* Find the innermost reference that is of the type we want. */
+ for (elt = TREE_PURPOSE (placeholder_list);
+ elt != 0
+ && (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
+ || TREE_CODE_CLASS (TREE_CODE (elt)) == '1'
+ || TREE_CODE_CLASS (TREE_CODE (elt)) == '2'
+ || 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
it was found in case it is also a PLACEHOLDER_EXPR.