summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/exprs.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-07 06:14:23 +0000
committerChris Lattner <sabre@nondot.org>2010-07-07 06:14:23 +0000
commit3956106543637429e25878d98948bee847be8966 (patch)
tree98b709c296080397f85220e56fc79081d3d6765a /clang/test/Sema/exprs.c
parent11086fcb654629ac5257a29f2b4f20070c00a83b (diff)
downloadbcm5719-llvm-3956106543637429e25878d98948bee847be8966.tar.gz
bcm5719-llvm-3956106543637429e25878d98948bee847be8966.zip
implement PR7569, warning about assignment to null, which
people seem to write when they want a deterministic trap. Suggest instead that they use a volatile pointer or __builtin_trap. llvm-svn: 107756
Diffstat (limited to 'clang/test/Sema/exprs.c')
-rw-r--r--clang/test/Sema/exprs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c
index dbb6e80aa6d..b22b5220f28 100644
--- a/clang/test/Sema/exprs.c
+++ b/clang/test/Sema/exprs.c
@@ -134,3 +134,11 @@ void test18(int b) {
test18_a(b, b); // expected-error {{too many arguments to function call, expected 1, have 2}}
test18_a(); // expected-error {{too few arguments to function call, expected 1, have 0}}
}
+
+// PR7569
+void test19() {
+ *(int*)0 = 0; // expected-warning {{indirection of non-volatile null pointer}} \
+ // expected-note {{consider using __builtin_trap}}
+ *(volatile int*)0 = 0; // Ok.
+}
+
OpenPOWER on IntegriCloud