Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / support / regression / tcc / 112_backtrace.c
blob8489bd32a65f86fcadb9ae6b6cd56e8f5fd33d02
1 #include <stdio.h>
3 /* ------------------------------------------------------- */
4 #if defined test_backtrace_1
6 void f3()
8 printf("* f3()\n"), fflush(stdout);
9 *(void**)0 = 0;
11 void f2()
13 printf("* f2()\n"), fflush(stdout);
14 f3();
16 void f1()
18 printf("* f1()\n"), fflush(stdout);
19 f2();
21 int main(int argc, char **argv)
23 printf("* main\n"), fflush(stdout);
24 f1();
25 printf("* exit main\n"), fflush(stdout);
26 return 0;
29 /* ------------------------------------------------------- */
30 #elif defined test_bcheck_1
32 struct s { int a,b,c,d,e; };
33 struct s s[3];
34 struct s *ps = s;
35 void f1()
37 printf("* f1()\n"), fflush(stdout);
38 ps[3] = ps[2];
40 int main(int argc, char **argv)
42 printf("* main\n"), fflush(stdout);
43 f1();
44 printf("* exit main\n"), fflush(stdout);
45 return 0;
48 /* ------------------------------------------------------- */
49 #elif defined test_tcc_backtrace_2
51 /* test custom backtrace and 'exit()' redirection */
52 int tcc_backtrace(const char *fmt, ...);
53 void exit(int);
55 void f2()
57 printf("* f2()\n");
58 printf("* exit f2\n"), fflush(stdout);
59 exit(34);
61 void f1()
63 printf("* f1()\n"), fflush(stdout);
64 tcc_backtrace("Hello from %s!", "f1");
65 f2();
67 int main(int argc, char **argv)
69 printf("* main\n"), fflush(stdout);
70 f1();
71 printf("* exit main\n"), fflush(stdout);
72 return 0;
75 /* ------------------------------------------------------- */
76 #elif defined test_tcc_backtrace_3
78 /* this test should be run despite of the exit(34) above */
79 int main(int argc, char **argv)
81 printf("* main\n"), fflush(stdout);
82 return 1;
85 /* ------------------------------------------------------- */
86 #else
87 #include <stdlib.h>
88 #include <string.h>
89 char *strdup();
90 int main()
92 char pad1[10];
93 char a[10];
94 char pad2[10];
95 char b[10];
96 char pad3[10];
97 memset (pad1, 0, sizeof(pad1));
98 memset (pad2, 0, sizeof(pad2));
99 memset (pad3, 0, sizeof(pad3));
101 memset (a, 'a', 10);
102 a[3] = 0;
103 a[9] = 0;
104 memset (b, 'b', 10);
106 #if defined test_bcheck_100
107 memcpy(&a[1],&b[0],10);
108 #elif defined test_bcheck_101
109 memcpy(&a[0],&b[1],10);
110 #elif defined test_bcheck_102
111 memcpy(&a[0],&a[3],4);
112 #elif defined test_bcheck_103
113 memcpy(&a[3],&a[0],4);
114 #elif defined test_bcheck_104
115 memcmp(&b[1],&b[0],10);
116 #elif defined test_bcheck_105
117 memcmp(&b[0],&b[1],10);
118 #elif defined test_bcheck_106
119 memmove(&b[1],&b[0],10);
120 #elif defined test_bcheck_107
121 memmove(&b[0],&b[1],10);
122 #elif defined test_bcheck_108
123 memset(&b[1],'b',10);
124 #elif defined test_bcheck_109
125 strlen(&b[0]);
126 #elif defined test_bcheck_110
127 strcpy(&a[7], &a[0]);
128 #elif defined test_bcheck_111
129 strcpy(&a[0], &b[7]);
130 #elif defined test_bcheck_112
131 strcpy(&a[0], &a[1]);
132 #elif defined test_bcheck_113
133 strcpy(&a[2], &a[0]);
134 #elif defined test_bcheck_114
135 strncpy(&a[7], &a[0], 10);
136 #elif defined test_bcheck_115
137 strncpy(&a[0], &b[7], 10);
138 #elif defined test_bcheck_116
139 strncpy(&a[0], &a[1], 10);
140 #elif defined test_bcheck_117
141 strncpy(&a[2], &a[0], 10);
142 #elif defined test_bcheck_118
143 strcmp(&b[2], &b[0]);
144 #elif defined test_bcheck_119
145 strcmp(&b[0], &b[2]);
146 #elif defined test_bcheck_120
147 strncmp(&b[5], &b[0], 10);
148 #elif defined test_bcheck_121
149 strncmp(&b[0], &b[5], 10);
150 #elif defined test_bcheck_122
151 strcat(&a[7], &a[0]);
152 #elif defined test_bcheck_123
153 strcat(&a[0], &b[3]);
154 #elif defined test_bcheck_124
155 strcat(&a[0], &a[4]);
156 #elif defined test_bcheck_125
157 strcat(&a[3], &a[0]);
158 #elif defined test_bcheck_126
159 strchr(&b[0], 'a');
160 #elif defined test_bcheck_127
161 free(strdup(&b[0]));
162 #endif
164 /* ------------------------------------------------------- */
165 #endif