brintos

brintos / llvm-project-archived public Read only

0
0
Text · 526 B · 6ead28b Raw
17 lines · c
1// RUN: %clang_analyze_cc1 -std=c23 -analyzer-checker=core,unix.StdCLibraryFunctions,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s2 3void clang_analyzer_eval(int);4 5typedef 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 radix8#define EOF (-0b11)9 10int getc(FILE *);11void test_getc(FILE *fp) {12  int y = getc(fp);13  if (y < 0) {14    clang_analyzer_eval(y == EOF); // expected-warning{{TRUE}}15  }16}17