26 lines · c
1// RUN: %clang_analyze_cc1 %s \2// RUN: -analyzer-checker=core \3// RUN: -analyzer-checker=debug.ExprInspection \4// RUN: -analyzer-config eagerly-assume=true \5// RUN: -verify6 7// Here we test that no assertion is fired during symbol simplification.8// Related issue: https://github.com/llvm/llvm-project/issues/555469 10extern void abort() __attribute__((__noreturn__));11#define assert(expr) ((expr) ? (void)(0) : abort())12 13void clang_analyzer_warnIfReached();14 15int a, b, c;16long L, L1;17void test() {18 assert(a + L + 1 + b != c);19 assert(L == a);20 assert(c == 0);21 L1 = 0;22 assert(a + L1 + 1 + b != c);23 assert(a == 0); // no-assertion24 clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}25}26