This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Several C++ regressions
On Aug 23, 2004, at 3:49 PM, Andrew Pinski wrote:
OK? Tested on powerpc-apple-darwin and this time no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* typeck.c (build_unary_op): Keep &a->b form when we can keep it.
I had forgot to wrap the comment right, here it is wrapped right.
Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.569
diff -u -p -r1.569 typeck.c
--- typeck.c 23 Aug 2004 18:24:18 -0000 1.569
+++ typeck.c 23 Aug 2004 23:13:26 -0000
@@ -4123,6 +4123,15 @@ build_unary_op (enum tree_code code, tre
addr = fold (build2 (PLUS_EXPR, argtype, rval,
cp_convert (argtype,
byte_position (field))));
+
+ /* If the folded PLUS_EXPR is not a constant address, wrap
+ it in an ADDR_EXPR unless we have a base class and we
+ require code to convert to the base class. */
+ if (!TREE_CONSTANT (addr)
+ && (!DECL_ARTIFICIAL (field)
+ || !TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P
+ (TREE_TYPE (TREE_OPERAND (arg, 0)))))
+ addr = build_address (arg);
}
if (TREE_CODE (argtype) == POINTER_TYPE