struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-string-opt-18.c
blob66d932e1406df5b64ecc660ac19b16b2b2f9a919
1 /*
2 string-opt-18.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* Copyright (C) 2003 Free Software Foundation.
13 Test equal pointer optimizations don't break anything.
15 Written by Roger Sayle, July 14, 2003. */
17 #include <string.h>
19 #ifndef __SDCC_pdk14 // Lack of memory
20 void test1 (void *ptr)
22 if (memcpy(ptr,ptr,8) != ptr)
23 ASSERT (0);
26 #if 0
27 // GNU-specific function
28 void test2 (char *ptr)
30 if (mempcpy(ptr,ptr,8) != ptr+8)
31 ASSERT (0);
33 #endif
35 void test3 (void *ptr)
37 if (memmove(ptr,ptr,8) != ptr)
38 ASSERT (0);
41 void test4 (char *ptr)
43 if (strcpy(ptr,ptr) != ptr)
44 ASSERT (0);
47 void test5 (void *ptr)
49 if (memcmp(ptr,ptr,8) != 0)
50 ASSERT (0);
53 void test6 (const char *ptr)
55 if (strcmp(ptr,ptr) != 0)
56 ASSERT (0);
59 void test7 (const char *ptr)
61 if (strncmp(ptr,ptr,8) != 0)
62 ASSERT (0);
64 #endif
66 void
67 testTortureExecute (void)
69 #ifndef __SDCC_pdk14 // Lack of memory
70 char buf[10];
72 test1 (buf);
73 #if 0
74 test2 (buf);
75 #endif
76 test3 (buf);
77 #if !defined (__APPLE__)
78 test4 (buf);
79 #endif
80 test5 (buf);
81 test6 (buf);
82 test7 (buf);
84 return;
85 #endif