1 /*
2    920810-1.c from the execute part of the gcc torture suite.
3  */
4 
5 #include <testfwk.h>
6 
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10 
11 #include <stdio.h>
12 #include <string.h>
13 #include <stdlib.h>
14 
15 #if !defined(__SDCC_pdk14) // Lack of memory
16 typedef struct { void* super; int name; int size; } t;
17 
f(t * clas,int size)18 t* f(t*clas, int size)
19 {
20   t* child = (t*)malloc(size);
21   memcpy(child, clas, clas->size);
22   child->super=clas;
23   child->name=0;
24   child->size=size;
25   return child;
26 }
27 #endif
28 
29 void
testTortureExecute(void)30 testTortureExecute (void)
31 {
32 #if !defined(__SDCC_pdk14) // Lack of memory
33   t foo, *bar;
34   memset(&foo, 37, sizeof(t));
35   foo.size=sizeof(t);
36   bar=f(&foo,sizeof(t));
37   ASSERTFALSE (bar->super!=&foo||bar->name!=0||bar->size!=sizeof(t));
38   return;
39 #endif
40 }
41