27 lines · c
1// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s2// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s3// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s4// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s5// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s6 7void clang_analyzer_eval(int);8 9typedef struct FILE FILE;10// Unorthodox EOF value.11#define EOF (-2)12 13int getc(FILE *);14void test_getc(FILE *fp) {15 16 int x;17 while ((x = getc(fp)) != EOF) {18 clang_analyzer_eval(x > 255); // expected-warning{{FALSE}}19 clang_analyzer_eval(x >= 0); // expected-warning{{TRUE}}20 }21 22 int y = getc(fp);23 if (y < 0) {24 clang_analyzer_eval(y == -2); // expected-warning{{TRUE}}25 }26}27