clang/test/Analysis/PR49642.c
raw| 1 | // RUN: %clang_analyze_cc1 -Wno-implicit-function-declaration -Wno-implicit-int -w -verify %s \ |
| 2 | // RUN: -analyzer-checker=core \ |
| 3 | // RUN: -analyzer-checker=unix.StdCLibraryFunctions |
| 4 | |
| 5 | // expected-no-diagnostics |
| 6 | |
| 7 | typedef ssize_t; |
| 8 | b; |
| 9 | |
| 10 | unsigned c; |
| 11 | int write(int, const void *, unsigned long); |
| 12 | |
| 13 | a() { |
| 14 | d(); |
| 15 | while (c > 0) { |
| 16 | b = write(0, d, c); |
| 17 | if (b) |
| 18 | c -= b; |
| 19 | b < 1; |
| 20 | } |
| 21 | if (c && c) { |
| 22 | // ^ no-crash |
| 23 | } |
| 24 | } |