1 /*
2    20000703-1.c from the execute part of the gcc torture tests.
3  */
4 
5 #include <testfwk.h>
6 
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10 
11 #include <string.h>
12 
13 struct baz
14 {
15   char a[17];
16   char b[3];
17   unsigned int c;
18   unsigned int d;
19 };
20 
foo(struct baz * p,unsigned int c,unsigned int d)21 void foo(struct baz *p, unsigned int c, unsigned int d)
22 {
23   memcpy (p->b, "abc", 3);
24   p->c = c;
25   p->d = d;
26 }
27 
bar(struct baz * p,unsigned int c,unsigned int d)28 void bar(struct baz *p, unsigned int c, unsigned int d)
29 {
30   { void *s = (p);
31      memset (s, '\0', sizeof (struct baz));
32      s; };
33   memcpy (p->a, "01234567890123456", 17);
34   memcpy (p->b, "abc", 3);
35   p->c = c;
36   p->d = d;
37 }
38 
39 void
testTortureExecute(void)40 testTortureExecute (void)
41 {
42 #if !defined(__SDCC_pdk14) // Lack of memory
43   struct baz p;
44   foo(&p, 71, 18);
45   if (p.c != 71 || p.d != 18)
46     ASSERT (0);
47   bar(&p, 59, 26);
48   if (p.c != 59 || p.d != 26)
49     ASSERT (0);
50   return;
51 #endif
52 }
53 
54