================ @@ -339,3 +363,107 @@ void fflush_on_open_failed_stream(void) { } fclose(F); } + +void test_fscanf_eof() { + FILE *F1 = tmpfile(); + if (!F1) + return; + + int a; + unsigned b; + int ret = fscanf(F1, "%d %u", &a, &b); + char c = fgetc(F1); // expected-warning {{Read function called when stream is in EOF state. Function has no effect}} + // expected-warning@-1 {{File position of the stream might be 'indeterminate' after a failed operation. Can cause undefined behavior}} ---------------- alejandro-alvarez-sonarsource wrote:
Yes, there is a note such as ``` clang/test/Analysis/stream.c Line 374: Assuming stream reaches end-of-file here ``` https://github.com/llvm/llvm-project/pull/82476 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits