URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 298 |
Rev 816 |
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "-O2" } */
|
/* { dg-options "-O2" } */
|
|
|
extern void abort(void);
|
extern void abort(void);
|
struct Bar { int p; };
|
struct Bar { int p; };
|
struct Foo { struct Bar *p; };
|
struct Foo { struct Bar *p; };
|
struct Bar p0 = { 0 };
|
struct Bar p0 = { 0 };
|
struct Bar p1 = { 1 };
|
struct Bar p1 = { 1 };
|
void bar(struct Foo *f)
|
void bar(struct Foo *f)
|
{
|
{
|
f->p = &p0;
|
f->p = &p0;
|
}
|
}
|
int foo(struct Foo *f)
|
int foo(struct Foo *f)
|
{
|
{
|
f->p->p = 1;
|
f->p->p = 1;
|
bar(f);
|
bar(f);
|
return f->p->p;
|
return f->p->p;
|
}
|
}
|
int main()
|
int main()
|
{
|
{
|
struct Foo f;
|
struct Foo f;
|
f.p = &p1;
|
f.p = &p1;
|
if (foo(&f) != 0)
|
if (foo(&f) != 0)
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.