This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Several C++ regressions



On Aug 23, 2004, at 10:12 AM, Zack Weinberg wrote:


Diego Novillo <dnovillo@redhat.com> writes:

On Mon, 2004-08-23 at 12:39, Andrew Pinski wrote:

OK?  Tested on powerpc-apple-darwin, this time with no regressions
and it fixes the regressions that were caused by my first patch.

I would rather back out the original patch to give you time to
investigate the real problem.  There may be other nasties lurking
around.

Mark and I concur. This is an optimization -- I know it works around some codegen bugs, but it doesn't fix the underlying problems with the alias analyzer -- so, since it breaks stuff, let's back it out and try again.


I finally figured out what was going on, the patch which I posted was
the right fix but was not able to detect cases where it was safe to
just build &a->b like when there was only one base class and such.
This new one patch always the C++ front-end to keep those in this form
and not lower then until later.

I should note that C++ front-end does the conversion to the base classes
where there need to be code in a subroutine of convert which is why the
generated code was wrong.

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.


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 22:42:00 -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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]