From 7faf1979bf7d7aa6353ee061f94ec81ef14384db Mon Sep 17 00:00:00 2001 From: hubicka Date: Wed, 17 Jan 2007 11:16:24 +0000 Subject: * ipa-type-escape.c (look_for_casts): Revamp using handled_component_p. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120849 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ipa-type-escape.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'gcc/ipa-type-escape.c') diff --git a/gcc/ipa-type-escape.c b/gcc/ipa-type-escape.c index 7b2fac104bc..ccb60109ee0 100644 --- a/gcc/ipa-type-escape.c +++ b/gcc/ipa-type-escape.c @@ -920,26 +920,21 @@ look_for_casts (tree lhs __attribute__((unused)), tree t) tree castfromvar = TREE_OPERAND (t, 0); check_cast (TREE_TYPE (t), castfromvar); } - else if (TREE_CODE (t) == COMPONENT_REF - || TREE_CODE (t) == INDIRECT_REF - || TREE_CODE (t) == BIT_FIELD_REF) - { - tree base = get_base_address (t); - while (t != base) - { - t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == VIEW_CONVERT_EXPR) - { - /* This may be some part of a component ref. - IE it may be a.b.VIEW_CONVERT_EXPR(c).d, AFAIK. - castfromref will give you a.b.c, not a. */ - tree castfromref = TREE_OPERAND (t, 0); - check_cast (TREE_TYPE (t), castfromref); - } - else if (TREE_CODE (t) == COMPONENT_REF) - get_canon_type (TREE_TYPE (TREE_OPERAND (t, 1)), false, false); - } - } + else + while (handled_component_p (t)) + { + t = TREE_OPERAND (t, 0); + if (TREE_CODE (t) == VIEW_CONVERT_EXPR) + { + /* This may be some part of a component ref. + IE it may be a.b.VIEW_CONVERT_EXPR(c).d, AFAIK. + castfromref will give you a.b.c, not a. */ + tree castfromref = TREE_OPERAND (t, 0); + check_cast (TREE_TYPE (t), castfromref); + } + else if (TREE_CODE (t) == COMPONENT_REF) + get_canon_type (TREE_TYPE (TREE_OPERAND (t, 1)), false, false); + } } /* Check to see if T is a read or address of operation on a static var -- cgit v1.2.1