URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 297 |
Rev 338 |
#include <stdlib.h>
|
#include <stdlib.h>
|
|
|
union tree_node;
|
union tree_node;
|
|
|
struct tree_common
|
struct tree_common
|
{
|
{
|
int a;
|
int a;
|
long b;
|
long b;
|
long c;
|
long c;
|
void *p;
|
void *p;
|
int d;
|
int d;
|
};
|
};
|
|
|
struct other_tree
|
struct other_tree
|
{
|
{
|
struct tree_common common;
|
struct tree_common common;
|
int arr[14];
|
int arr[14];
|
};
|
};
|
|
|
struct tree_vec
|
struct tree_vec
|
{
|
{
|
struct tree_common common;
|
struct tree_common common;
|
int length;
|
int length;
|
union tree_node *a[1];
|
union tree_node *a[1];
|
};
|
};
|
|
|
union tree_node
|
union tree_node
|
{
|
{
|
struct other_tree othr;
|
struct other_tree othr;
|
struct tree_vec vec;
|
struct tree_vec vec;
|
};
|
};
|
|
|
union tree_node global;
|
union tree_node global;
|
|
|
union tree_node * __attribute__((noinline))
|
union tree_node * __attribute__((noinline))
|
foo (union tree_node *p, int i)
|
foo (union tree_node *p, int i)
|
{
|
{
|
union tree_node **q;
|
union tree_node **q;
|
p->vec.a[i] = (union tree_node *) 0;
|
p->vec.a[i] = (union tree_node *) 0;
|
q = &p->vec.a[1];
|
q = &p->vec.a[1];
|
*q = &global;
|
*q = &global;
|
return p->vec.a[i];
|
return p->vec.a[i];
|
}
|
}
|
|
|
extern void abort (void);
|
extern void abort (void);
|
extern void *malloc (__SIZE_TYPE__);
|
extern void *malloc (__SIZE_TYPE__);
|
|
|
int
|
int
|
main()
|
main()
|
{
|
{
|
union tree_node *p = malloc (sizeof (union tree_node));
|
union tree_node *p = malloc (sizeof (union tree_node));
|
if (foo (p, 1) != &global)
|
if (foo (p, 1) != &global)
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.