brintos

brintos / llvm-project-archived public Read only

0
0
Text · 479 B · 3930f5a Raw
19 lines · cpp
1// RUN: %clang_analyze_cc1 \2// RUN:  -analyzer-checker=core -analyzer-config \3// RUN:   silence-checkers=core.DivideZero \4// RUN:  -verify %s5 6void test_disable_core_div_by_zero() {7  (void)(1 / 0);8  // expected-warning@-1 {{division by zero is undefined}}9  // no-warning: 'Division by zero'10}11 12void test_disable_null_deref(int *p) {13  if (p)14    return;15 16  int x = p[0];17  // expected-warning@-1 {{Array access (from variable 'p') results in a null pointer dereference}}18}19