]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/array-repeat.c
src-release.sh: Use -T0 for xz compression
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / array-repeat.c
CommitLineData
1d506c26 1/* Copyright 2022-2024 Free Software Foundation, Inc.
6b4338c8
MR
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 3 of the License, or
6 (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
15
16#include <stdio.h>
17
18int
19main (void)
20{
21 int array_1d[5];
22 int array_1d9[6];
23 int array_2d[5][5];
24 int array_2d9[6][6];
25 int array_3d[5][5][5];
26 int array_3d9[6][6][6];
27 int i;
28
29 for (i = 0; i < sizeof (array_1d) / sizeof (int); i++)
30 *(array_1d + i) = 1;
31 for (i = 0; i < sizeof (array_1d9) / sizeof (int); i++)
32 *(array_1d9 + i) = i % 6 == 5 ? 9 : 1;
33 for (i = 0; i < sizeof (array_2d) / sizeof (int); i++)
34 *(*array_2d + i) = 2;
35 for (i = 0; i < sizeof (array_2d9) / sizeof (int); i++)
36 *(*array_2d9 + i) = i / 6 == 5 || i % 6 == 5 ? 9 : 2;
37 for (i = 0; i < sizeof (array_3d) / sizeof (int); i++)
38 *(**array_3d + i) = 3;
39 for (i = 0; i < sizeof (array_3d9) / sizeof (int); i++)
40 *(**array_3d9 + i) = i / 6 / 6 == 5 || i / 6 % 6 == 5 || i % 6 == 5 ? 9 : 3;
41
42 printf("\n"); /* Break here */
43 for (i = 0; i < sizeof (array_1d) / sizeof (int); i++)
44 printf(" %d", *(array_1d + i));
45 printf("\n");
46 for (i = 0; i < sizeof (array_1d9) / sizeof (int); i++)
47 printf(" %d", *(array_1d9 + i));
48 printf("\n");
49 for (i = 0; i < sizeof (array_2d) / sizeof (int); i++)
50 printf(" %d", *(*array_2d + i));
51 printf("\n");
52 for (i = 0; i < sizeof (array_2d9) / sizeof (int); i++)
53 printf(" %d", *(*array_2d9 + i));
54 printf("\n");
55 for (i = 0; i < sizeof (array_3d) / sizeof (int); i++)
56 printf(" %d", *(**array_3d + i));
57 printf("\n");
58 for (i = 0; i < sizeof (array_3d9) / sizeof (int); i++)
59 printf(" %d", *(**array_3d9 + i));
60 printf("\n");
61
62 return 0;
63}