2002-05-10 David S. Miller <davem@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 920810-1.c
blob9565bfc1a2bb89fc1be5687693c495252e99dbd3
1 #include <stdio.h>
2 #include <string.h>
3 #include <stdlib.h>
5 typedef struct{void*super;int name;int size;}t;
6 t*f(t*clas,int size)
8 t*child=(t*)malloc(size);
9 memcpy(child,clas,clas->size);
10 child->super=clas;
11 child->name=0;
12 child->size=size;
13 return child;
15 main()
17 t foo,*bar;
18 memset(&foo,37,sizeof(t));
19 foo.size=sizeof(t);
20 bar=f(&foo,sizeof(t));
21 if(bar->super!=&foo||bar->name!=0||bar->size!=sizeof(t))abort();
22 exit(0);