URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do run { target fpic } }
|
// { dg-do run { target fpic } }
|
// { dg-options "-fPIC" }
|
// { dg-options "-fPIC" }
|
// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } }
|
// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } }
|
// Test that non-variadic function calls using thunks and PIC work right.
|
// Test that non-variadic function calls using thunks and PIC work right.
|
|
|
struct A {
|
struct A {
|
void* p;
|
void* p;
|
A (void* q): p (q) { }
|
A (void* q): p (q) { }
|
A (const A& a): p (a.p) { }
|
A (const A& a): p (a.p) { }
|
};
|
};
|
|
|
class CBase {
|
class CBase {
|
public:
|
public:
|
virtual void BaseFunc();
|
virtual void BaseFunc();
|
};
|
};
|
|
|
class MMixin {
|
class MMixin {
|
public:
|
public:
|
virtual A MixinFunc(int arg, A arg2) = 0;
|
virtual A MixinFunc(int arg, A arg2) = 0;
|
};
|
};
|
|
|
class CExample : public CBase, public MMixin {
|
class CExample : public CBase, public MMixin {
|
public:
|
public:
|
A MixinFunc(int arg, A arg2);
|
A MixinFunc(int arg, A arg2);
|
};
|
};
|
|
|
void CBase::BaseFunc()
|
void CBase::BaseFunc()
|
{
|
{
|
}
|
}
|
|
|
A CExample::MixinFunc(int arg, A arg2)
|
A CExample::MixinFunc(int arg, A arg2)
|
{
|
{
|
if (arg != 1 || arg2.p != 0)
|
if (arg != 1 || arg2.p != 0)
|
return 0;
|
return 0;
|
return this;
|
return this;
|
}
|
}
|
|
|
void* test(MMixin& anExample)
|
void* test(MMixin& anExample)
|
{
|
{
|
return anExample.MixinFunc(1,A(0)).p;
|
return anExample.MixinFunc(1,A(0)).p;
|
}
|
}
|
|
|
main ()
|
main ()
|
{
|
{
|
CExample c;
|
CExample c;
|
|
|
if (test(c) != &c)
|
if (test(c) != &c)
|
return 1;
|
return 1;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.