Clang Project

clang_source_code/test/Analysis/PR37855.c
1// RUN: %clang_cc1 -analyze -analyzer-checker=core -w -DNO_CROSSCHECK -verify %s
2// RUN: %clang_cc1 -analyze -analyzer-checker=core -w -analyzer-config crosscheck-with-z3=true -verify %s
3// REQUIRES: z3
4
5typedef struct o p;
6struct o {
7  struct {
8  } s;
9};
10
11void q(*r, p2) { r < p2; }
12
13void k(l, node) {
14  struct {
15    p *node;
16  } * n, *nodep, path[sizeof(void)];
17  path->node = l;
18  for (n = path; node != l;) {
19    q(node, n->node);
20    nodep = n;
21  }
22  if (nodep) // expected-warning {{Branch condition evaluates to a garbage value}}
23    n[1].node->s;
24}
25