Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstringop-overflow-67.c
blob0f01082ede4013f66e7a70c8bd6dcd89d0e57ccb
1 /* PR middle-end/100571 - bogus -Wstringop-overflow with VLA of elements
2 larger than byte
3 { dg-do compile }
4 { dg-options "-O2 -Wall" }
5 { dg-require-effective-target alloca } */
7 __attribute__ ((access (read_only, 1, 2))) void fro (int *, int);
8 __attribute__ ((access (write_only, 1, 2))) void fwo (int *, int);
9 __attribute__ ((access (read_write, 1, 2))) void frw (int *, int);
11 extern __SIZE_TYPE__ n;
13 void alloca_ro (void)
15 int *a = __builtin_alloca (n * sizeof *a);
16 a[0] = 0;
17 fro (a, n);
20 void alloca_wo (void)
22 int *a = __builtin_alloca (n * sizeof *a);
23 fwo (a, n);
26 void alloca_rw (void)
28 int *a = __builtin_alloca (n * sizeof *a);
29 a[0] = 0;
30 frw (a, n);
34 void calloc_ro (void)
36 int *a = __builtin_calloc (n, sizeof *a);
37 fro (a, n);
40 void calloc_wo (void)
42 int *a = __builtin_calloc (n, sizeof *a);
43 fwo (a, n);
46 void calloc_rw (void)
48 int *a = __builtin_calloc (n, sizeof *a);
49 a[0] = 0;
50 frw (a, n);
54 void malloc_ro (void)
56 int *a = __builtin_malloc (n * sizeof *a);
57 a[0] = 0;
58 fro (a, n);
61 void malloc_wo (void)
63 int *a = __builtin_malloc (n * sizeof *a);
64 fwo (a, n);
67 void malloc_rw (void)
69 int *a = __builtin_malloc (n * sizeof *a);
70 a[0] = 0;
71 frw (a, n);
75 void vla_ro (void)
77 int a[n];
78 a[0] = 0;
79 fro (a, n);
82 void vla_wo (void)
84 int a[n];
85 fwo (a, n);
88 void vla_rw (void)
90 int a[n];
91 a[0] = 0;
92 frw (a, n);