aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-pr19430.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2008-08-20 22:23:45 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2008-08-20 22:23:45 +0000
commit87fe2bd0e02ac4b73d300854367de0f599d06ec8 (patch)
tree660ae75a4cdf11380c42d11680fdb1c7ead51a82 /gcc/testsuite/gcc.dg/uninit-pr19430.c
parent7735154d75efdab60161db87b086ee2c3572d512 (diff)
downloadgcc-87fe2bd0e02ac4b73d300854367de0f599d06ec8.zip
gcc-87fe2bd0e02ac4b73d300854367de0f599d06ec8.tar.gz
gcc-87fe2bd0e02ac4b73d300854367de0f599d06ec8.tar.bz2
re PR middle-end/179 (-Wuninitialized missing warning with &var)
2008-08-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/179 * tree-ssa.c (warn_uninit): Do not warn for variables that can be initialized outside the current module. (warn_uninitialized_var): Ignore left-hand side when walking the trees. Ignore address expressions. Examine VUSE operands in gimple statements with a variable declaration on the right-hand side. testsuite/ * gcc.dg/uninit-6.c (make_something): Remove XFAIL. * gcc.dg/uninit-6-O0.c (make_something): Remove XFAIL. * gcc.dg/uninit-B.c (baz): Remove XFAIL. * gcc.dg/uninit-B-2.c: New. * gcc.dg/uninit-B-O0-2.c: New. * gcc.dg/uninit-pr19430-O0.c: New. * gcc.dg/uninit-pr19430.c: New. * gcc.dg/uninit-pr19430-2.c: New. From-SVN: r139347
Diffstat (limited to 'gcc/testsuite/gcc.dg/uninit-pr19430.c')
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr19430.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-pr19430.c b/gcc/testsuite/gcc.dg/uninit-pr19430.c
new file mode 100644
index 0000000..ecf9c009
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr19430.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+extern int bar (int);
+extern void baz (int *);
+int
+foo (int i)
+{
+ int j; /* { dg-warning "'j' may be used uninitialized in this function" "uninitialized" { xfail *-*-* } 8 } */
+
+ if (bar (i)) {
+ baz (&j);
+ } else {
+ }
+
+ return j;
+}
+
+
+
+int foo2( void ) {
+ int rc; /* { dg-warning "'rc' is used uninitialized in this function" } */
+ return rc;
+ *&rc = 0;
+}
+
+extern int printf(const char *, ...);
+void frob(int *pi);
+
+int main(void)
+{
+ int i;
+ printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" } */
+ frob(&i);
+
+ return 0;
+}
+
+void foo3(int*);
+void bar3(void) {
+ int x;
+ if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" } */
+ foo3(&x);
+}