summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/symbolic-12.c
blob: d7c50de9f2706ce3569d81781be72fa43b19148a (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "analyzer-decls.h"

void external_fn(void);

struct st_1
{
  char *name;
  unsigned size;
};

void test_1a (void *p, unsigned next_off)
{
  struct st_1 *r = p;

  external_fn();

  if (next_off >= r->size)
    return;

  if (next_off >= r->size)
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}

void test_1b (void *p, unsigned next_off)
{
  struct st_1 *r = p;

  if (next_off >= r->size)
    return;

  if (next_off >= r->size)
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}

void test_1c (struct st_1 *r, unsigned next_off)
{
  if (next_off >= r->size)
    return;

  if (next_off >= r->size)
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}

void test_1d (struct st_1 *r, unsigned next_off)
{
  external_fn();

  if (next_off >= r->size)
    return;

  if (next_off >= r->size)
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}

void test_1e (void *p, unsigned next_off)
{
  struct st_1 *r = p;

  while (1)
    {
      external_fn();

      if (next_off >= r->size)
	return;

      __analyzer_dump_path (); /* { dg-message "path" } */
    }
}

struct st_2
{
  char *name;
  unsigned arr[10];
};

void test_2a (void *p, unsigned next_off)
{
  struct st_2 *r = p;

  external_fn();

  if (next_off >= r->arr[5])
    return;

  if (next_off >= r->arr[5])
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}

void test_2b (void *p, unsigned next_off, int idx)
{
  struct st_2 *r = p;

  external_fn();

  if (next_off >= r->arr[idx])
    return;

  if (next_off >= r->arr[idx])
    /* We should have already returned if this is the case.  */
    __analyzer_dump_path (); /* { dg-bogus "path" } */
}