Debian Codegraph @

gcc/testsuite/gcc.dg/ubsan/pr113012.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fsanitize=undefined" } */
3
4 int *
5 foo (int x, int y, int z, int w)
6 {
7 int *p = __builtin_malloc (z * sizeof (int));
8 int *q = p - 1;
9 while (--x > 0)
10 {
11 if (w + 1 > y)
12 q = p - 1;
13 ++*q;
14 ++q;
15 }
16 return p;
17 }