clang/test/Analysis/division-by-zero-track-zero.c
raw| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core \ |
| 2 | // RUN: -analyzer-output=text \ |
| 3 | // RUN: -verify %s |
| 4 | |
| 5 | int track_mul_lhs_0(int x, int y) { |
| 6 | int p0 = x < 0; // expected-note {{Assuming 'x' is >= 0}} \ |
| 7 | // expected-note {{'p0' initialized to 0}} |
| 8 | int div = p0 * y; // expected-note {{'div' initialized to 0}} |
| 9 | return 1 / div; // expected-note {{Division by zero}} \ |
| 10 | // expected-warning {{Division by zero}} |
| 11 | } |