Clang Project

clang_source_code/test/Analysis/exploration_order/noexprcrash.c
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config exploration_strategy=unexplored_first %s
2// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config exploration_strategy=dfs %s
3
4extern void clang_analyzer_eval(int);
5
6typedef struct { char a; } b;
7int c(b* input) {
8    int x = (input->a ?: input) ? 1 : 0; // expected-warning{{pointer/integer type mismatch}}
9    if (input->a) {
10      // FIXME: The value should actually be "TRUE",
11      // but is incorrect due to a bug.
12      clang_analyzer_eval(x); // expected-warning{{FALSE}}
13    } else {
14      clang_analyzer_eval(x); // expected-warning{{TRUE}}
15    }
16    return x;
17}
18