This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR optimization/6086
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- To: Jakub Jelinek <jakub at redhat dot com>,Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 2 Apr 2002 23:50:21 +0200
- Subject: Re: [PATCH] Fix PR optimization/6086
- References: <20020330000554.Q32482@sunsite.ms.mff.cuni.cz>
On Saturday 30 March 2002 00:05, Jakub Jelinek wrote:
> Hi!
>
> It looks like Jan deleted too much code from combine_simplify_rtx in
> 2001-05-17 patch. Specifically, old code used to
> return CLOBBER and not the original SUBREG in some cases (like
> mode dependent or volatile MEM).
> Ok to commit if testing succeeds?
> I've simplified the original testcase to:
>
> struct A
> {
> A (int x, int y);
> int a, b;
> int foo () { return a; }
> int bar () { return b; }
> };
>
> struct B
> {
> virtual ~B ();
> virtual A baz () const;
> };
>
> struct C
> {
> A foo () const;
> B *c;
> };
>
> A C::foo () const
> {
> int x, y;
> x = c->baz ().foo ();
> y = c->baz ().bar ();
> return A (x, y);
> }
>
> at -O+, where proper code generation can be checked e.g. in -da dumps,
> but without a real ppc I'm afraid I cannot easily cook up an
> executable testcase which will fail if compiled by gcc 3.1 without
> this patch and succeed with gcc 3.0 or gcc 3.1 with this patch.
> Franz, could you try to write something (IMHO this
> is a problem which deserves a testcase)?
Jakub,
Daniel Jacobowitz changed the testcase into an executable one and I verified
that it fails without your patch and passes with your patch on
powerpc-linux-gnu.
Franz.
#include <stdlib.h>
struct A
{
A (int x, int y);
int a, b;
int foo () { return a; }
int bar () { return b; }
};
struct B
{
virtual ~B ();
virtual A baz () const;
};
struct C
{
A foo () const;
B *c;
};
A C::foo () const
{
int x, y;
x = c->baz ().foo ();
y = c->baz ().bar ();
return A (x, y);
}
A B::baz () const
{
return A (4, 8);
}
A::A (int x, int y)
{
a = x;
b = y;
}
B::~B ()
{
}
int
main ()
{
C the_c;
B the_b;
the_c.c = &the_b;
if (the_c.foo().a != 4)
abort ();
return 0;
}