From 9d9165ef4838d286ac546d6168ffa8a4712acc2c Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 10 May 2005 05:31:15 +0000 Subject: [PATCH] typeck.c (build_unary_op): Do not resort to address arithmetic when taking the address of a COMPONENT_REF. * typeck.c (build_unary_op): Do not resort to address arithmetic when taking the address of a COMPONENT_REF. From-SVN: r99503 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/typeck.c | 11 +++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5052341..8241534 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-05-09 Mark Mitchell + + * typeck.c (build_unary_op): Do not resort to address arithmetic + when taking the address of a COMPONENT_REF. + 2005-05-08 Kazu Hirata * class.c (vtbl_init_data_s): Change the type of fns to diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2b4d9ec..bd73969 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4107,15 +4107,10 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert) } else { + tree object = TREE_OPERAND (arg, 0); tree field = TREE_OPERAND (arg, 1); - tree rval = build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0), 0); - tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (rval)), - decl_type_context (field), - ba_check, NULL); - - rval = build_base_path (PLUS_EXPR, rval, binfo, 1); - - TREE_OPERAND (arg, 0) = build_indirect_ref (rval, NULL); + gcc_assert (same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (object), decl_type_context (field))); addr = build_address (arg); } -- 2.7.4