gcc/testsuite/ChangeLog:
* gcc.dg/uninit-pr50476.c: New test.
From-SVN: r274135
2019-08-05 Martin Sebor <msebor@redhat.com>
+ PR middle-end/50476
+ * gcc.dg/uninit-pr50476.c: New test.
+
PR c++/60517
* g++.dg/pr60517.C: New test.
--- /dev/null
+/* PR middle-end/50476 - Warn of pointer set to object whose lifetime is limited
+ { dg-do compile }
+ { dg-options "-O1 -Wall" } */
+
+int *x = 0;
+
+void f (void)
+{
+ int y = 1;
+ x = &y;
+}
+
+int g (void)
+{
+ f ();
+
+ return *x; // { dg-warning "\\\[-Wuninitialized" }
+}