Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr121103-1.c

raw
1 /* { dg-do compile } */
2 /* PR tree-optimization/121103 */
3
4 extern void *memmove(void *, const void *, __SIZE_TYPE__) __attribute__((noreturn));
5
6 struct A {
7 const char *s;
8 int n;
9 };
10
11 void f(void *);
12
13 struct B {
14 char d[5];
15 int n;
16 };
17
18 __attribute__((always_inline)) inline void g(struct B *p, struct A a) {
19 int i = a.n;
20 if (i <= 5)
21 p->n = i;
22 else {
23 p->n = -1;
24 f(p);
25 }
26
27 if (p->n >= 0)
28 memmove(p->d, a.s, a.n); /* { dg-bogus "\\\[-Warray-bounds" } */
29 }
30
31 void h(void) {
32 char c[8] = "";
33
34 struct A a;
35 a.s = c;
36 a.n = 8;
37
38 struct B b;
39 g(&b, a);
40 }