[clang] [NFC][analyzer] Add regression tests from bisection commits to the CSA's test suite (PR #241058)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 02:40:21 PST 2026


================
@@ -109,3 +109,18 @@ int t6() {
   return 1 / (f.x - 32); // expected-warning {{Division by zero}}
 }
 }
+
+namespace GH40797 {
+typedef __typeof(sizeof(int)) size_t;
+typedef long ssize_t;
+
+ssize_t read(int fd, void *buf, size_t count);
+
+ssize_t read_n(void *p, size_t size, size_t n) {
+  size_t len = n * size;
+  if (size && len / size != n)
+    return 0;
+  return len ? read(0, p, len) / size : 0; // no-warning
----------------
steakhal wrote:

```suggestion
  return len ? read(0, p, len) / size : 0; // no-warning: size can't be zero, thus no div by zero
```

https://github.com/llvm/llvm-project/pull/241058


More information about the cfe-commits mailing list