[cfe-commits] r109736 - in /cfe/trunk/test/Analysis: array-struct-region.c array-struct.c
Jordy Rose
jediknil at belkadan.com
Thu Jul 29 00:11:59 PDT 2010
Author: jrose
Date: Thu Jul 29 02:11:59 2010
New Revision: 109736
URL: http://llvm.org/viewvc/llvm-project?rev=109736&view=rev
Log:
Move new test (that requires RegionStore) into its own file.
Added:
cfe/trunk/test/Analysis/array-struct-region.c
Modified:
cfe/trunk/test/Analysis/array-struct.c
Added: cfe/trunk/test/Analysis/array-struct-region.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/array-struct-region.c?rev=109736&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/array-struct-region.c (added)
+++ cfe/trunk/test/Analysis/array-struct-region.c Thu Jul 29 02:11:59 2010
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
+
+int string_literal_init() {
+ char a[] = "abc";
+ char b[2] = "abc"; // expected-warning{{too long}}
+ char c[5] = "abc";
+
+ if (a[1] != 'b')
+ return 0; // expected-warning{{never executed}}
+ if (b[1] != 'b')
+ return 0; // expected-warning{{never executed}}
+ if (c[1] != 'b')
+ return 0; // expected-warning{{never executed}}
+
+ if (a[3] != 0)
+ return 0; // expected-warning{{never executed}}
+ if (c[3] != 0)
+ return 0; // expected-warning{{never executed}}
+
+ if (c[4] != 0)
+ return 0; // expected-warning{{never executed}}
+
+ return 42;
+}
Modified: cfe/trunk/test/Analysis/array-struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/array-struct.c?rev=109736&r1=109735&r2=109736&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/array-struct.c (original)
+++ cfe/trunk/test/Analysis/array-struct.c Thu Jul 29 02:11:59 2010
@@ -178,26 +178,3 @@
if (*q) { // no-warning
}
}
-
-int f19() {
- char a[] = "abc";
- char b[2] = "abc"; // expected-warning{{too long}}
- char c[5] = "abc";
-
- if (a[1] != 'b')
- return 5; // expected-warning{{never executed}}
- if (b[1] != 'b')
- return 5; // expected-warning{{never executed}}
- if (c[1] != 'b')
- return 5; // expected-warning{{never executed}}
-
- if (a[3] != 0)
- return 5; // expected-warning{{never executed}}
- if (c[3] != 0)
- return 5; // expected-warning{{never executed}}
-
- if (c[4] != 0)
- return 5; // expected-warning{{never executed}}
-
- return 0;
-}
More information about the cfe-commits
mailing list