[cfe-commits] r75708 - in /cfe/trunk/test/Analysis: misc-ps-region-store-i386.m misc-ps-region-store-x86_64.m misc-ps-region-store.m
Ted Kremenek
kremenek at apple.com
Tue Jul 14 16:17:23 PDT 2009
Author: kremenek
Date: Tue Jul 14 18:17:22 2009
New Revision: 75708
URL: http://llvm.org/viewvc/llvm-project?rev=75708&view=rev
Log:
Split out 'test2' into an i386 and x86_64 file, illustrating how the
test behavior differs between architectures. When this is no longer
the case, these tests will be merged.
Added:
cfe/trunk/test/Analysis/misc-ps-region-store-i386.m
cfe/trunk/test/Analysis/misc-ps-region-store-x86_64.m
Modified:
cfe/trunk/test/Analysis/misc-ps-region-store.m
Added: cfe/trunk/test/Analysis/misc-ps-region-store-i386.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store-i386.m?rev=75708&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store-i386.m (added)
+++ cfe/trunk/test/Analysis/misc-ps-region-store-i386.m Tue Jul 14 18:17:22 2009
@@ -0,0 +1,29 @@
+// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s
+
+typedef struct _BStruct { void *grue; } BStruct;
+void testB_aux(void *ptr);
+void testB(BStruct *b) {
+ {
+ int *__gruep__ = ((int *)&((b)->grue));
+ int __gruev__ = *__gruep__;
+ int __gruev2__ = *__gruep__;
+ if (__gruev__ != __gruev2__) {
+ int *p = 0;
+ *p = 0xDEADBEEF;
+ }
+
+ testB_aux(__gruep__);
+ }
+ {
+ int *__gruep__ = ((int *)&((b)->grue));
+ int __gruev__ = *__gruep__;
+ int __gruev2__ = *__gruep__;
+ if (__gruev__ != __gruev2__) {
+ int *p = 0;
+ *p = 0xDEADBEEF;
+ }
+
+ if (~0 != __gruev__) {}
+ }
+}
+
Added: cfe/trunk/test/Analysis/misc-ps-region-store-x86_64.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store-x86_64.m?rev=75708&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store-x86_64.m (added)
+++ cfe/trunk/test/Analysis/misc-ps-region-store-x86_64.m Tue Jul 14 18:17:22 2009
@@ -0,0 +1,31 @@
+// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s
+
+// This test case appears in misc-ps-region-store-i386.m, but fails under x86_64.
+// The reason is that 'int' is smaller than a pointer on a 64-bit architecture,
+// and we aren't reasoning yet about just the first 32-bits of the pointer.
+typedef struct _BStruct { void *grue; } BStruct;
+void testB_aux(void *ptr);
+void testB(BStruct *b) {
+ {
+ int *__gruep__ = ((int *)&((b)->grue));
+ int __gruev__ = *__gruep__;
+ int __gruev2__ = *__gruep__;
+ if (__gruev__ != __gruev2__) {
+ int *p = 0;
+ *p = 0xDEADBEEF; // no-warning
+ }
+
+ testB_aux(__gruep__);
+ }
+ {
+ int *__gruep__ = ((int *)&((b)->grue));
+ int __gruev__ = *__gruep__;
+ int __gruev2__ = *__gruep__;
+ if (__gruev__ != __gruev2__) {
+ int *p = 0;
+ *p = 0xDEADBEEF; // expected-warning{{null}}
+ }
+
+ if (~0 != __gruev__) {}
+ }
+}
Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=75708&r1=75707&r2=75708&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Tue Jul 14 18:17:22 2009
@@ -1,4 +1,5 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s
+// RUN: clang-cc -triple i386-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s &&
+// RUN: clang-cc -triple x86_64-apple-darwin9 -analyze -checker-cfref --analyzer-store=region --verify -fblocks %s
typedef struct objc_selector *SEL;
typedef signed char BOOL;
@@ -86,29 +87,11 @@
// of fields.
typedef struct _BStruct { void *grue; } BStruct;
void testB_aux(void *ptr);
+
void testB(BStruct *b) {
- {
- int *__gruep__ = ((int *)&((b)->grue));
- int __gruev__ = *__gruep__;
- int __gruev2__ = *__gruep__;
- if (__gruev__ != __gruev2__) {
- int *p = 0;
- *p = 0xDEADBEEF;
- }
-
- testB_aux(__gruep__);
- }
- {
- int *__gruep__ = ((int *)&((b)->grue));
- int __gruev__ = *__gruep__;
- int __gruev2__ = *__gruep__;
- if (__gruev__ != __gruev2__) {
- int *p = 0;
- *p = 0xDEADBEEF;
- }
-
- if (~0 != __gruev__) {}
- }
+ // This case has moved to 'misc-ps-region-store-i386.m' and
+ // 'misc-ps-region-store-x86_64.m'. It succeeds under x86_64. When it
+ // passes it both, pull it in here.
}
void testB_2(BStruct *b) {
More information about the cfe-commits
mailing list