summaryrefslogtreecommitdiffstats
path: root/clang/docs/analyzer/checkers/dividezero_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/docs/analyzer/checkers/dividezero_example.c')
-rw-r--r--clang/docs/analyzer/checkers/dividezero_example.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/docs/analyzer/checkers/dividezero_example.c b/clang/docs/analyzer/checkers/dividezero_example.c
new file mode 100644
index 00000000000..00ffaac491e
--- /dev/null
+++ b/clang/docs/analyzer/checkers/dividezero_example.c
@@ -0,0 +1,9 @@
+void test(int z) {
+ if (z == 0)
+ int x = 1 / z; // warn
+}
+
+void test() {
+ int x = 1;
+ int y = x % 0; // warn
+}
OpenPOWER on IntegriCloud