clang/test/Analysis/uninit-exhaustive-switch-bug.c
raw| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s |
| 2 | // expected-no-diagnostics |
| 3 | |
| 4 | int rand(void); |
| 5 | |
| 6 | void test(void) { |
| 7 | int offset = 0; |
| 8 | int value; |
| 9 | int test = rand(); |
| 10 | switch (test & 0x1) { |
| 11 | case 0: |
| 12 | case 1: |
| 13 | value = 0; |
| 14 | break; |
| 15 | } |
| 16 | |
| 17 | offset += value; // no-warning |
| 18 | } |