summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pred-2_b.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/uninit-pred-2_b.c')
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pred-2_b.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-pred-2_b.c b/gcc/testsuite/gcc.dg/uninit-pred-2_b.c
new file mode 100644
index 000000000..ac7697e3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pred-2_b.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -O2" } */
+
+int g;
+void bar (void);
+void blah (int);
+
+int foo (int n, int m, int r)
+{
+ int flag = 0;
+ int v;
+
+ if (n)
+ {
+ v = r;
+ flag = 1;
+ }
+
+ if (m)
+ g++;
+ else
+ bar();
+
+ /* Wrong guard */
+ if (!flag)
+ blah(v); /* { dg-warning "uninitialized" "real uninitialized var warning" } */
+
+ return 0;
+}