2017-12-08 Richard Biener <rguenther@suse.de>
PR middle-end/81782
* tree-ssa-uninit.c (warn_uninitialized_vars): Properly
handle accesses outside of zero-sized vars.
* gcc.dg/uninit-pr81782.c: New testcase.
From-SVN: r255512
+2017-12-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81782
+ * tree-ssa-uninit.c (warn_uninitialized_vars): Properly
+ handle accesses outside of zero-sized vars.
+
2017-12-08 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/83141
+2017-12-08 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81782
+ * gcc.dg/uninit-pr81782.c: New testcase.
+
2017-12-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* g++.dg/opt/pr83252.C: Add -mclear-hwcap on *-*-solaris*.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wmaybe-uninitialized" } */
+
+int
+foo (void)
+{
+ char empty_array[] = { };
+ int i, ret = 0;
+
+ for (i = 0; i < (int) (sizeof (empty_array) / sizeof (empty_array[0])); i++)
+ ret = empty_array[i]; /* { dg-bogus "uninitialized" } */
+
+ return ret;
+}
variable. */
if (DECL_P (base)
&& ref.size != -1
- && ref.max_size == ref.size
- && (ref.offset + ref.size <= 0
+ && ((ref.max_size == ref.size
+ && ref.offset + ref.size <= 0)
|| (ref.offset >= 0
&& DECL_SIZE (base)
&& TREE_CODE (DECL_SIZE (base)) == INTEGER_CST