Debian Codegraph @

clang/test/Analysis/std-c-library-functions-eof-2-rad.c

raw
1 // RUN: %clang_analyze_cc1 -std=c23 -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
2
3 void clang_analyzer_eval(int);
4
5 typedef struct FILE FILE;
6 /// Test that the static analyzer doesn't interpret the most significant bit as the sign bit.
7 // Unorthodox EOF value with a power of 2 radix
8 #define EOF (-0b11)
9
10 int getc(FILE *);
11 void test_getc(FILE *fp) {
12 int y = getc(fp);
13 if (y < 0) {
14 clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}
15 }
16 }