URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
void abort(void);
|
void abort(void);
|
void exit(int);
|
void exit(int);
|
struct baz
|
struct baz
|
{
|
{
|
char a[17];
|
char a[17];
|
char b[3];
|
char b[3];
|
unsigned int c;
|
unsigned int c;
|
unsigned int d;
|
unsigned int d;
|
};
|
};
|
|
|
void foo(struct baz *p, unsigned int c, unsigned int d)
|
void foo(struct baz *p, unsigned int c, unsigned int d)
|
{
|
{
|
__builtin_memcpy (p->b, "abc", 3);
|
__builtin_memcpy (p->b, "abc", 3);
|
p->c = c;
|
p->c = c;
|
p->d = d;
|
p->d = d;
|
}
|
}
|
|
|
void bar(struct baz *p, unsigned int c, unsigned int d)
|
void bar(struct baz *p, unsigned int c, unsigned int d)
|
{
|
{
|
({ void *s = (p);
|
({ void *s = (p);
|
__builtin_memset (s, '\0', sizeof (struct baz));
|
__builtin_memset (s, '\0', sizeof (struct baz));
|
s; });
|
s; });
|
__builtin_memcpy (p->a, "01234567890123456", 17);
|
__builtin_memcpy (p->a, "01234567890123456", 17);
|
__builtin_memcpy (p->b, "abc", 3);
|
__builtin_memcpy (p->b, "abc", 3);
|
p->c = c;
|
p->c = c;
|
p->d = d;
|
p->d = d;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
struct baz p;
|
struct baz p;
|
foo(&p, 71, 18);
|
foo(&p, 71, 18);
|
if (p.c != 71 || p.d != 18)
|
if (p.c != 71 || p.d != 18)
|
abort();
|
abort();
|
bar(&p, 59, 26);
|
bar(&p, 59, 26);
|
if (p.c != 59 || p.d != 26)
|
if (p.c != 59 || p.d != 26)
|
abort();
|
abort();
|
exit(0);
|
exit(0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.