================
@@ -778,42 +781,61 @@ void StreamChecker::evalFgetc(const FnDescription *Desc, 
const CallEvent &Call,
   assertStreamStateOpened(OldSS);
 
----------------
steakhal wrote:

This patch caused a downstream test failure.
Here is the fix:

```suggestion
  // We don't model the buffer, thus they should escape.
  State = Call.invalidateRegions(C.blockCount(), State);
```

Test where it currently breaks:
```c++
void test_double_switch_ok() {
  char buffer[10] = {10};
  FILE *F1 = tmpfile();
  if (!F1)
    return;

  char* s = fgets(buffer, sizeof(buffer), F1); // ok
  if (s) {
    clang_analyzer_dump_char(buffer[0]); // expected-warning {{conj_$}} Should 
not preserve the previous value, thus should not be 10.
  }
  // Hmm, what do we know of the buffer on failure? IDK.

  fclose(F1);
}
```

https://github.com/llvm/llvm-project/pull/73638
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to