aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/ptr-arith.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/ptr-arith.c')
-rw-r--r--test/Analysis/ptr-arith.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c
index b9eecfcf1f..e53cc54426 100644
--- a/test/Analysis/ptr-arith.c
+++ b/test/Analysis/ptr-arith.c
@@ -41,3 +41,12 @@ void f4() {
int *p;
p = (int*) 0x10000; // expected-warning{{Using a fixed address is not portable because that address will probably not be valid in all environments or platforms.}}
}
+
+void f5() {
+ int x, y;
+ int *p;
+ p = &x + 1; // expected-warning{{Pointer arithmetic done on non array variables means reliance on memory layout, which is dangerous.}}
+
+ int a[10];
+ p = a + 1; // no-warning
+}