[cfe-commits] r156720 - /cfe/trunk/test/Analysis/array-struct-region.c
Jordy Rose
jediknil at belkadan.com
Sat May 12 10:32:59 PDT 2012
Author: jrose
Date: Sat May 12 12:32:59 2012
New Revision: 156720
URL: http://llvm.org/viewvc/llvm-project?rev=156720&view=rev
Log:
[analyzer] Test case: p->x is the same as p[0].x. (PR7297)
Modified:
cfe/trunk/test/Analysis/array-struct-region.c
Modified: cfe/trunk/test/Analysis/array-struct-region.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/array-struct-region.c?rev=156720&r1=156719&r2=156720&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/array-struct-region.c (original)
+++ cfe/trunk/test/Analysis/array-struct-region.c Sat May 12 12:32:59 2012
@@ -45,3 +45,16 @@
vec[a][1] *= rad; // no-warning
}
}
+
+
+void struct_as_array() {
+ struct simple { int x; };
+ struct simple a;
+ struct simple *p = &a;
+ p->x = 5;
+ if (!p[0].x)
+ return; // expected-warning{{never executed}}
+ if (p[0].x)
+ return; // no-warning
+}
+
More information about the cfe-commits
mailing list