aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr96598.c
blob: b4354cd3394fcbe779119b2a2f4a6212e20bc335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* { dg-additional-options "-O0 -fsanitize=undefined" } */

extern char *foo (char *dest, const char *src)
  __attribute__ ((__nonnull__ (1, 2)));

unsigned bar(const char *str)
  __attribute__ ((__nonnull__ ()));

unsigned test(const char *str, unsigned **pv)
  __attribute__ ((__nonnull__ ()));

unsigned test(const char* str, unsigned **pv)
{
  char buffer[130];

  *pv = 0;

  foo(buffer, str);
  if (bar(buffer))
    {
      const char *ptr = 0;
      foo(buffer, str);
      return bar(buffer);
    }
  return 0;
}