summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-10 05:31:15 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-10 05:31:15 +0000
commit31292c565b0d9536f3ec8bcc8042ddac72696dc4 (patch)
treedaaa213b949f3072f2aae9c12d1da4ef4fd5b0b8
parentbe7e699b73206b681cba9ce7642cbf99e9ced329 (diff)
downloadppe42-gcc-31292c565b0d9536f3ec8bcc8042ddac72696dc4.tar.gz
ppe42-gcc-31292c565b0d9536f3ec8bcc8042ddac72696dc4.zip
* typeck.c (build_unary_op): Do not resort to address arithmetic
when taking the address of a COMPONENT_REF. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99503 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck.c11
2 files changed, 8 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 50523410176..82415340a9e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-09 Mark Mitchell <mark@codesourcery.com>
+
+ * typeck.c (build_unary_op): Do not resort to address arithmetic
+ when taking the address of a COMPONENT_REF.
+
2005-05-08 Kazu Hirata <kazu@cs.umass.edu>
* 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 2b4d9ec32ef..bd73969058e 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);
}
OpenPOWER on IntegriCloud