URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
// PR optimization/6086
|
// PR optimization/6086
|
// { dg-do run }
|
// { dg-do run }
|
// { dg-options "-O" }
|
// { dg-options "-O" }
|
|
|
extern "C" void abort (void);
|
extern "C" void abort (void);
|
|
|
struct A
|
struct A
|
{
|
{
|
A (int x, int y);
|
A (int x, int y);
|
int a, b;
|
int a, b;
|
int foo () { return a; }
|
int foo () { return a; }
|
int bar () { return b; }
|
int bar () { return b; }
|
};
|
};
|
|
|
struct B
|
struct B
|
{
|
{
|
virtual ~B ();
|
virtual ~B ();
|
virtual A baz () const;
|
virtual A baz () const;
|
};
|
};
|
|
|
struct C
|
struct C
|
{
|
{
|
A foo () const;
|
A foo () const;
|
B *c;
|
B *c;
|
};
|
};
|
|
|
A C::foo () const
|
A C::foo () const
|
{
|
{
|
int x, y;
|
int x, y;
|
x = c->baz ().foo ();
|
x = c->baz ().foo ();
|
y = c->baz ().bar ();
|
y = c->baz ().bar ();
|
return A (x, y);
|
return A (x, y);
|
}
|
}
|
|
|
A B::baz () const
|
A B::baz () const
|
{
|
{
|
return A (4, 8);
|
return A (4, 8);
|
}
|
}
|
|
|
A::A (int x, int y)
|
A::A (int x, int y)
|
{
|
{
|
a = x;
|
a = x;
|
b = y;
|
b = y;
|
}
|
}
|
|
|
B::~B ()
|
B::~B ()
|
{
|
{
|
}
|
}
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
C the_c;
|
C the_c;
|
B the_b;
|
B the_b;
|
the_c.c = &the_b;
|
the_c.c = &the_b;
|
if (the_c.foo().a != 4)
|
if (the_c.foo().a != 4)
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.