PR middle-end/89284
* passes.def: Swap pass_ubsan and pass_early_warn_uninitialized.
* gcc.dg/ubsan/pr89284.c: New test.
From-SVN: r268862
+2019-02-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/89284
+ * passes.def: Swap pass_ubsan and pass_early_warn_uninitialized.
+
2019-02-13 Ian Lance Taylor <iant@golang.org>
* optc-save-gen.awk: Set var_opt_hash for initial optimizations
NEXT_PASS (pass_fixup_cfg);
NEXT_PASS (pass_build_ssa);
NEXT_PASS (pass_warn_nonnull_compare);
- NEXT_PASS (pass_ubsan);
NEXT_PASS (pass_early_warn_uninitialized);
+ NEXT_PASS (pass_ubsan);
NEXT_PASS (pass_nothrow);
NEXT_PASS (pass_rebuild_cgraph_edges);
POP_INSERT_PASSES ()
+2019-02-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/89284
+ * gcc.dg/ubsan/pr89284.c: New test.
+
2019-02-13 Ian Lance Taylor <iant@golang.org>
* gcc.dg/func-attr-1.c: New test.
--- /dev/null
+/* PR middle-end/89284 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -O0 -Wuninitialized" } */
+
+struct A { _Bool a; int i; };
+
+int
+foo (void)
+{
+ struct A a;
+ if (a.i) /* { dg-warning "'a.i' is used uninitialized in this function" } */
+ return 1;
+ return 0;
+}
+
+int
+bar (void)
+{
+ struct A a;
+ if (a.a) /* { dg-warning "'a.a' is used uninitialized in this function" } */
+ return 1;
+ return 0;
+}