================ @@ -259,14 +283,33 @@ void error_indeterminate_clearerr(void) { fclose(F); } +void error_indeterminate_fgetc(void) { + FILE *F = fopen("file", "r+"); + if (!F) + return; + int rc = fseek(F, 0, SEEK_SET); + if (rc) { + if (feof(F)) { + clang_analyzer_warnIfReached(); // no warning + fgetc(F); // no warning + } else if (ferror(F)) { + fgetc(F); // expected-warning {{might be 'indeterminate'}} + } else { + fgetc(F); // expected-warning {{might be 'indeterminate'}} + } + } + fclose(F); +} + void error_indeterminate_fputc(void) { FILE *F = fopen("file", "r+"); if (!F) return; int rc = fseek(F, 0, SEEK_SET); if (rc) { if (feof(F)) { ---------------- balazske wrote:
The branch `feof(F)` is not needed at all here. There is a previous test case that tells that `feof(F)` is never true when fseek to a 0 position is called. https://github.com/llvm/llvm-project/pull/72627 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits