summaryrefslogtreecommitdiffstats
path: root/test/Analysis/globals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/globals.cpp')
-rw-r--r--test/Analysis/globals.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Analysis/globals.cpp b/test/Analysis/globals.cpp
index 5bbb241bdc..d3df6eb6d2 100644
--- a/test/Analysis/globals.cpp
+++ b/test/Analysis/globals.cpp
@@ -109,3 +109,18 @@ void recordinit()
S3 s3;
*(s3.p - 1) = 0; // expected-warning{{Dereference of null pointer}}
}
+
+extern int ext_int;
+
+void update_original_declaration() {
+ ext_int = 2;
+}
+
+extern int ext_int;
+
+int test_redeclaration() {
+ ext_int = 1;
+ update_original_declaration();
+ int int_int = 3 / (ext_int - 1); // no-warning
+ return int_int / (ext_int - 2); // expected-warning{{Division by zero}}
+}