brintos

brintos / llvm-project-archived public Read only

0
0
Text · 412 B · 658da72 Raw
29 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s2 3// expected-no-diagnostics4 5void halt() __attribute__((__noreturn__));6void assert(int b) {7  if (!b)8    halt();9}10 11void decode(unsigned width) {12  assert(width > 0);13 14  int base;15  bool inited = false;16 17  int i = 0;18 19  if (i % width == 0) {20    base = 512;21    inited = true;22  }23 24  base += 1; // no-warning25 26  if (base >> 10)27    assert(false);28}29