PR tree-optimization/67955
[official-gcc.git] / gcc / testsuite / c-c++-common / memset-array.c
blob0346a210bb04c3846b3e8ca9273e0db8dbaa2ba6
1 /* { dg-do compile } */
2 /* { dg-options "-Wmemset-elt-size" } */
3 enum a {
4 a_1,
5 a_2,
6 a_n
7 };
8 int t1[20];
9 int t2[a_n];
11 struct s
13 int t[20];
16 void foo (struct s *s)
18 __builtin_memset (t1, 0, 20); /* { dg-warning "element size" } */
19 __builtin_memset (t2, 0, a_n); /* { dg-warning "element size" } */
20 __builtin_memset (s->t, 0, 20); /* { dg-warning "element size" } */
23 char u1[20];
24 char u2[a_n];
26 struct s2
28 char u[20];
31 void bar (struct s2 *s)
33 __builtin_memset (u1, 0, 20);
34 __builtin_memset (u2, 0, a_n);
35 __builtin_memset (s->u, 0, 20);