summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pr20644.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/uninit-pr20644.c')
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr20644.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-pr20644.c b/gcc/testsuite/gcc.dg/uninit-pr20644.c
new file mode 100644
index 000000000..e13910bec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr20644.c
@@ -0,0 +1,24 @@
+/* PR 20644 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+int foo ()
+{
+ int i = 0;
+ int j;
+
+ if (1 == i)
+ return j;
+
+ return 0;
+}
+
+int bar ()
+{
+ int i = 1;
+ int j;
+
+ if (1 == i)
+ return j; /* { dg-warning "uninitialized" "uninitialized" { target *-*-* } 18 } */
+
+ return 0;
+}