From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- test/Analysis/ptr-arith.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/Analysis/ptr-arith.cpp (limited to 'test/Analysis/ptr-arith.cpp') diff --git a/test/Analysis/ptr-arith.cpp b/test/Analysis/ptr-arith.cpp new file mode 100644 index 0000000..5f09518 --- /dev/null +++ b/test/Analysis/ptr-arith.cpp @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s +// expected-no-diagnostics +struct X { + int *p; + int zero; + void foo () { + reset(p - 1); + } + void reset(int *in) { + while (in != p) // Loop must be entered. + zero = 1; + } +}; + +int test (int *in) { + X littleX; + littleX.zero = 0; + littleX.p = in; + littleX.foo(); + return 5/littleX.zero; // no-warning +} + -- cgit v1.1