1// PR c++/40502
2// { dg-do compile }
3// { dg-options "-O2" }
4// { dg-skip-if "packed attribute missing for struct A" { "epiphany-*-*" } { "*" } { "" } }
5
6struct A { char x[12], y[35]; };
7struct B { char z[50]; };
8
9inline void
10foo (char *dest, const char *__restrict src, __SIZE_TYPE__ n)
11{
12  __builtin___strncpy_chk (dest, src, n, __builtin_object_size (dest, 0));	// { dg-warning "will always overflow" }
13}
14
15void bar (const char *, int);
16
17inline void
18baz (int i)
19{
20  char s[128], t[32];
21  bar (s, 0);
22  bar (t, i);
23  A a;
24  B b;
25  foo (a.y, b.z, 36);
26}
27
28void
29test ()
30{
31  baz (0);
32}
33