1 1.1 christos /* This testcase is part of GDB, the GNU debugger. 2 1.1 christos 3 1.11 christos Copyright 1996-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This program is free software; you can redistribute it and/or modify 6 1.1 christos it under the terms of the GNU General Public License as published by 7 1.1 christos the Free Software Foundation; either version 3 of the License, or 8 1.1 christos (at your option) any later version. 9 1.1 christos 10 1.1 christos This program is distributed in the hope that it will be useful, 11 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1 christos GNU General Public License for more details. 14 1.1 christos 15 1.1 christos You should have received a copy of the GNU General Public License 16 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 1.1 christos 18 1.1 christos /* Useful abreviations. */ 19 1.1 christos typedef void t; 20 1.1 christos typedef char tc; 21 1.1 christos typedef short ts; 22 1.1 christos typedef int ti; 23 1.1 christos typedef long tl; 24 1.1 christos typedef long long tll; 25 1.1 christos typedef float tf; 26 1.1 christos typedef double td; 27 1.1 christos typedef long double tld; 28 1.1 christos 29 1.1 christos /* Force the type of each field. */ 30 1.1 christos #ifndef tA 31 1.1 christos typedef t tA; 32 1.1 christos #endif 33 1.1 christos #ifndef tB 34 1.1 christos typedef tA tB; 35 1.1 christos #endif 36 1.1 christos #ifndef tC 37 1.1 christos typedef tB tC; 38 1.1 christos #endif 39 1.1 christos #ifndef tD 40 1.1 christos typedef tC tD; 41 1.1 christos #endif 42 1.1 christos #ifndef tE 43 1.1 christos typedef tD tE; 44 1.1 christos #endif 45 1.1 christos #ifndef tF 46 1.1 christos typedef tE tF; 47 1.1 christos #endif 48 1.1 christos #ifndef tG 49 1.1 christos typedef tF tG; 50 1.1 christos #endif 51 1.1 christos #ifndef tH 52 1.1 christos typedef tG tH; 53 1.1 christos #endif 54 1.1 christos #ifndef tI 55 1.1 christos typedef tH tI; 56 1.1 christos #endif 57 1.1 christos #ifndef tJ 58 1.1 christos typedef tI tJ; 59 1.1 christos #endif 60 1.1 christos #ifndef tK 61 1.1 christos typedef tJ tK; 62 1.1 christos #endif 63 1.1 christos #ifndef tL 64 1.1 christos typedef tK tL; 65 1.1 christos #endif 66 1.1 christos #ifndef tM 67 1.1 christos typedef tL tM; 68 1.1 christos #endif 69 1.1 christos #ifndef tN 70 1.1 christos typedef tM tN; 71 1.1 christos #endif 72 1.1 christos #ifndef tO 73 1.1 christos typedef tN tO; 74 1.1 christos #endif 75 1.1 christos #ifndef tP 76 1.1 christos typedef tO tP; 77 1.1 christos #endif 78 1.1 christos #ifndef tQ 79 1.1 christos typedef tP tQ; 80 1.1 christos #endif 81 1.1 christos #ifndef tR 82 1.1 christos typedef tQ tR; 83 1.1 christos #endif 84 1.1 christos 85 1.1 christos struct struct1 {tA a;}; 86 1.1 christos struct struct2 {tA a; tB b;}; 87 1.1 christos struct struct3 {tA a; tB b; tC c; }; 88 1.1 christos struct struct4 {tA a; tB b; tC c; tD d; }; 89 1.1 christos struct struct5 {tA a; tB b; tC c; tD d; tE e; }; 90 1.1 christos struct struct6 {tA a; tB b; tC c; tD d; tE e; tF f; }; 91 1.1 christos struct struct7 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; }; 92 1.1 christos struct struct8 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; }; 93 1.1 christos struct struct9 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; }; 94 1.1 christos struct struct10 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; }; 95 1.1 christos struct struct11 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; }; 96 1.1 christos struct struct12 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; }; 97 1.1 christos struct struct13 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; }; 98 1.1 christos struct struct14 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; }; 99 1.1 christos struct struct15 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; }; 100 1.1 christos struct struct16 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; }; 101 1.1 christos struct struct17 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; tQ q; }; 102 1.1 christos struct struct18 {tA a; tB b; tC c; tD d; tE e; tF f; tG g; tH h; tI i; tJ j; tK k; tL l; tM m; tN n; tO o; tP p; tQ q; tR r; }; 103 1.1 christos 104 1.1 christos struct struct1 foo1 = {'1'}, L1; 105 1.1 christos struct struct2 foo2 = {'a','2'}, L2; 106 1.1 christos struct struct3 foo3 = {'1','b','3'}, L3; 107 1.1 christos struct struct4 foo4 = {'a','2','c','4'}, L4; 108 1.1 christos struct struct5 foo5 = {'1','b','3','d','5'}, L5; 109 1.1 christos struct struct6 foo6 = {'a','2','c','4','e','6'}, L6; 110 1.1 christos struct struct7 foo7 = {'1','b','3','d','5','f','7'}, L7; 111 1.1 christos struct struct8 foo8 = {'a','2','c','4','e','6','g','8'}, L8; 112 1.1 christos struct struct9 foo9 = {'1','b','3','d','5','f','7','h','9'}, L9; 113 1.1 christos struct struct10 foo10 = {'a','2','c','4','e','6','g','8','i','A'}, L10; 114 1.1 christos struct struct11 foo11 = {'1','b','3','d','5','f','7','h','9','j','B'}, L11; 115 1.1 christos struct struct12 foo12 = {'a','2','c','4','e','6','g','8','i','A','k','C'}, L12; 116 1.1 christos struct struct13 foo13 = {'1','b','3','d','5','f','7','h','9','j','B','l','D'}, L13; 117 1.1 christos struct struct14 foo14 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E'}, L14; 118 1.1 christos struct struct15 foo15 = {'1','b','3','d','5','f','7','h','9','j','B','l','D','n','F'}, L15; 119 1.1 christos struct struct16 foo16 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E','o','G'}, L16; 120 1.1 christos struct struct17 foo17 = {'1','b','3','d','5','f','7','h','9','j','B','l','D','n','F','p','H'}, L17; 121 1.1 christos struct struct18 foo18 = {'a','2','c','4','e','6','g','8','i','A','k','C','m','E','o','G','q','I'}, L18; 122 1.1 christos 123 1.1 christos struct struct1 fun1() 124 1.1 christos { 125 1.1 christos return foo1; 126 1.1 christos } 127 1.1 christos struct struct2 fun2() 128 1.1 christos { 129 1.1 christos return foo2; 130 1.1 christos } 131 1.1 christos struct struct3 fun3() 132 1.1 christos { 133 1.1 christos return foo3; 134 1.1 christos } 135 1.1 christos struct struct4 fun4() 136 1.1 christos { 137 1.1 christos return foo4; 138 1.1 christos } 139 1.1 christos struct struct5 fun5() 140 1.1 christos { 141 1.1 christos return foo5; 142 1.1 christos } 143 1.1 christos struct struct6 fun6() 144 1.1 christos { 145 1.1 christos return foo6; 146 1.1 christos } 147 1.1 christos struct struct7 fun7() 148 1.1 christos { 149 1.1 christos return foo7; 150 1.1 christos } 151 1.1 christos struct struct8 fun8() 152 1.1 christos { 153 1.1 christos return foo8; 154 1.1 christos } 155 1.1 christos struct struct9 fun9() 156 1.1 christos { 157 1.1 christos return foo9; 158 1.1 christos } 159 1.1 christos struct struct10 fun10() 160 1.1 christos { 161 1.1 christos return foo10; 162 1.1 christos } 163 1.1 christos struct struct11 fun11() 164 1.1 christos { 165 1.1 christos return foo11; 166 1.1 christos } 167 1.1 christos struct struct12 fun12() 168 1.1 christos { 169 1.1 christos return foo12; 170 1.1 christos } 171 1.1 christos struct struct13 fun13() 172 1.1 christos { 173 1.1 christos return foo13; 174 1.1 christos } 175 1.1 christos struct struct14 fun14() 176 1.1 christos { 177 1.1 christos return foo14; 178 1.1 christos } 179 1.1 christos struct struct15 fun15() 180 1.1 christos { 181 1.1 christos return foo15; 182 1.1 christos } 183 1.1 christos struct struct16 fun16() 184 1.1 christos { 185 1.1 christos return foo16; 186 1.1 christos } 187 1.1 christos struct struct17 fun17() 188 1.1 christos { 189 1.1 christos return foo17; 190 1.1 christos } 191 1.1 christos struct struct18 fun18() 192 1.1 christos { 193 1.1 christos return foo18; 194 1.1 christos } 195 1.1 christos 196 1.1 christos void Fun1(struct struct1 foo1) 197 1.1 christos { 198 1.1 christos L1 = foo1; 199 1.1 christos } 200 1.1 christos void Fun2(struct struct2 foo2) 201 1.1 christos { 202 1.1 christos L2 = foo2; 203 1.1 christos } 204 1.1 christos void Fun3(struct struct3 foo3) 205 1.1 christos { 206 1.1 christos L3 = foo3; 207 1.1 christos } 208 1.1 christos void Fun4(struct struct4 foo4) 209 1.1 christos { 210 1.1 christos L4 = foo4; 211 1.1 christos } 212 1.1 christos void Fun5(struct struct5 foo5) 213 1.1 christos { 214 1.1 christos L5 = foo5; 215 1.1 christos } 216 1.1 christos void Fun6(struct struct6 foo6) 217 1.1 christos { 218 1.1 christos L6 = foo6; 219 1.1 christos } 220 1.1 christos void Fun7(struct struct7 foo7) 221 1.1 christos { 222 1.1 christos L7 = foo7; 223 1.1 christos } 224 1.1 christos void Fun8(struct struct8 foo8) 225 1.1 christos { 226 1.1 christos L8 = foo8; 227 1.1 christos } 228 1.1 christos void Fun9(struct struct9 foo9) 229 1.1 christos { 230 1.1 christos L9 = foo9; 231 1.1 christos } 232 1.1 christos void Fun10(struct struct10 foo10) 233 1.1 christos { 234 1.1 christos L10 = foo10; 235 1.1 christos } 236 1.1 christos void Fun11(struct struct11 foo11) 237 1.1 christos { 238 1.1 christos L11 = foo11; 239 1.1 christos } 240 1.1 christos void Fun12(struct struct12 foo12) 241 1.1 christos { 242 1.1 christos L12 = foo12; 243 1.1 christos } 244 1.1 christos void Fun13(struct struct13 foo13) 245 1.1 christos { 246 1.1 christos L13 = foo13; 247 1.1 christos } 248 1.1 christos void Fun14(struct struct14 foo14) 249 1.1 christos { 250 1.1 christos L14 = foo14; 251 1.1 christos } 252 1.1 christos void Fun15(struct struct15 foo15) 253 1.1 christos { 254 1.1 christos L15 = foo15; 255 1.1 christos } 256 1.1 christos void Fun16(struct struct16 foo16) 257 1.1 christos { 258 1.1 christos L16 = foo16; 259 1.1 christos } 260 1.1 christos void Fun17(struct struct17 foo17) 261 1.1 christos { 262 1.1 christos L17 = foo17; 263 1.1 christos } 264 1.1 christos void Fun18(struct struct18 foo18) 265 1.1 christos { 266 1.1 christos L18 = foo18; 267 1.1 christos } 268 1.1 christos 269 1.3 christos void 270 1.1 christos zed () 271 1.1 christos { 272 1.1 christos 273 1.1 christos L1.a = L2.a = L3.a = L4.a = L5.a = L6.a = L7.a = L8.a = L9.a = L10.a = L11.a = L12.a = L13.a = L14.a = L15.a = L16.a = L17.a = L18.a = 'Z'; 274 1.1 christos 275 1.1 christos L2.b = L3.b = L4.b = L5.b = L6.b = L7.b = L8.b = L9.b = L10.b = L11.b = L12.b = L13.b = L14.b = L15.b = L16.b = L17.b = L18.b = 'Z'; 276 1.1 christos 277 1.1 christos L3.c = L4.c = L5.c = L6.c = L7.c = L8.c = L9.c = L10.c = L11.c = L12.c = L13.c = L14.c = L15.c = L16.c = L17.c = L18.c = 'Z'; 278 1.1 christos 279 1.1 christos L4.d = L5.d = L6.d = L7.d = L8.d = L9.d = L10.d = L11.d = L12.d = L13.d = L14.d = L15.d = L16.d = L17.d = L18.d = 'Z'; 280 1.1 christos 281 1.1 christos L5.e = L6.e = L7.e = L8.e = L9.e = L10.e = L11.e = L12.e = L13.e = L14.e = L15.e = L16.e = L17.e = L18.e = 'Z'; 282 1.1 christos 283 1.1 christos L6.f = L7.f = L8.f = L9.f = L10.f = L11.f = L12.f = L13.f = L14.f = L15.f = L16.f = L17.f = L18.f = 'Z'; 284 1.1 christos 285 1.1 christos L7.g = L8.g = L9.g = L10.g = L11.g = L12.g = L13.g = L14.g = L15.g = L16.g = L17.g = L18.g = 'Z'; 286 1.1 christos 287 1.1 christos L8.h = L9.h = L10.h = L11.h = L12.h = L13.h = L14.h = L15.h = L16.h = L17.h = L18.h = 'Z'; 288 1.1 christos 289 1.1 christos L9.i = L10.i = L11.i = L12.i = L13.i = L14.i = L15.i = L16.i = L17.i = L18.i = 'Z'; 290 1.1 christos 291 1.1 christos L10.j = L11.j = L12.j = L13.j = L14.j = L15.j = L16.j = L17.j = L18.j = 'Z'; 292 1.1 christos 293 1.1 christos L11.k = L12.k = L13.k = L14.k = L15.k = L16.k = L17.k = L18.k = 'Z'; 294 1.1 christos 295 1.1 christos L12.l = L13.l = L14.l = L15.l = L16.l = L17.l = L18.l = 'Z'; 296 1.1 christos 297 1.1 christos L13.m = L14.m = L15.m = L16.m = L17.m = L18.m = 'Z'; 298 1.1 christos 299 1.1 christos L14.n = L15.n = L16.n = L17.n = L18.n = 'Z'; 300 1.1 christos 301 1.1 christos L15.o = L16.o = L17.o = L18.o = 'Z'; 302 1.1 christos 303 1.1 christos L16.p = L17.p = L18.p = 'Z'; 304 1.1 christos 305 1.1 christos L17.q = L18.q = 'Z'; 306 1.1 christos 307 1.1 christos L18.r = 'Z'; 308 1.1 christos } 309 1.1 christos 310 1.1 christos static struct { char c; } chartest[256]; 311 1.1 christos 312 1.1 christos int main() 313 1.1 christos { 314 1.1 christos int i; 315 1.1 christos 316 1.1 christos for (i = 0; i < 256; i++) 317 1.1 christos chartest[i].c = i; 318 1.1 christos chartest[0].c = 0; /* chartest-done */ 319 1.1 christos 320 1.1 christos Fun1(foo1); 321 1.1 christos Fun2(foo2); 322 1.1 christos Fun3(foo3); 323 1.1 christos Fun4(foo4); 324 1.1 christos Fun5(foo5); 325 1.1 christos Fun6(foo6); 326 1.1 christos Fun7(foo7); 327 1.1 christos Fun8(foo8); 328 1.1 christos Fun9(foo9); 329 1.1 christos Fun10(foo10); 330 1.1 christos Fun11(foo11); 331 1.1 christos Fun12(foo12); 332 1.1 christos Fun13(foo13); 333 1.1 christos Fun14(foo14); 334 1.1 christos Fun15(foo15); 335 1.1 christos Fun16(foo16); 336 1.1 christos Fun17(foo17); 337 1.1 christos Fun18(foo18); 338 1.1 christos 339 1.3 christos /* An (almost-)infinite loop that first clears all the variables and then 340 1.1 christos calls each function. This "hack" is to make testing random 341 1.1 christos functions easier - "advance funN" is guaranteed to have always 342 1.3 christos been preceded by a global variable clearing zed call. 343 1.3 christos We don't let this run forever in case gdb crashes while testing, 344 1.3 christos we don't want to be left eating all cpu on the user's system. */ 345 1.1 christos 346 1.3 christos for (i = 0; i < 1000000; ++i) 347 1.1 christos { 348 1.1 christos zed (); 349 1.1 christos L1 = fun1(); 350 1.1 christos L2 = fun2(); 351 1.1 christos L3 = fun3(); 352 1.1 christos L4 = fun4(); 353 1.1 christos L5 = fun5(); 354 1.1 christos L6 = fun6(); 355 1.1 christos L7 = fun7(); 356 1.1 christos L8 = fun8(); 357 1.1 christos L9 = fun9(); 358 1.1 christos L10 = fun10(); 359 1.1 christos L11 = fun11(); 360 1.1 christos L12 = fun12(); 361 1.1 christos L13 = fun13(); 362 1.1 christos L14 = fun14(); 363 1.1 christos L15 = fun15(); 364 1.1 christos L16 = fun16(); 365 1.1 christos L17 = fun17(); 366 1.1 christos L18 = fun18(); 367 1.1 christos } 368 1.1 christos 369 1.1 christos return 0; 370 1.1 christos } 371