void
predicate::init_from_control_deps (const vec<edge> *dep_chains,
- unsigned num_chains)
+ unsigned num_chains, bool is_use)
{
gcc_assert (is_empty ());
return;
if (DEBUG_PREDICATE_ANALYZER && dump_file)
- fprintf (dump_file, "init_from_control_deps {%s}:\n",
+ fprintf (dump_file, "init_from_control_deps [%s] {%s}:\n",
+ is_use ? "USE" : "DEF",
format_edge_vecs (dep_chains, num_chains).c_str ());
/* Convert the control dependency chain into a set of predicates. */
if (is_gimple_call (cond_stmt) && EDGE_COUNT (e->src->succs) >= 2)
/* Ignore EH edge. Can add assertion on the other edge's flag. */
continue;
- /* Skip if there is essentially one succesor. */
- if (EDGE_COUNT (e->src->succs) == 2)
+ /* Skip this edge if it is bypassing an abort - when the
+ condition is not satisfied we are neither reaching the
+ definition nor the use so it isn't meaningful. Note if
+ we are processing the use predicate the condition is
+ meaningful. See PR65244. */
+ if (!is_use && EDGE_COUNT (e->src->succs) == 2)
{
edge e1;
edge_iterator ei1;
condition under which the definition in DEF_BB is used in USE_BB.
Each OR subexpression is represented by one element of DEP_CHAINS,
where each element consists of a series of AND subexpressions. */
- use_preds.init_from_control_deps (dep_chains, num_chains);
+ use_preds.init_from_control_deps (dep_chains, num_chains, true);
return !use_preds.is_empty ();
}
/* Convert control dependence chains to the predicate in *THIS under
which the PHI operands are defined to values for which M_EVAL is
false. */
- m_phi_def_preds.init_from_control_deps (dep_chains, num_chains);
+ m_phi_def_preds.init_from_control_deps (dep_chains, num_chains, false);
return !m_phi_def_preds.is_empty ();
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Og -Wuninitialized -ftree-bit-ccp -fno-thread-jumps -fdump-tree-uninit2" } */
+
+void exit(int __status) __attribute__ ((__noreturn__));
+int posix_memalign(void **__memptr, __SIZE_TYPE__ __alignment,
+ __SIZE_TYPE__ __size);
+
+void *f(void)
+{
+ void *ptr;
+
+ if (posix_memalign(&ptr, 16, 256) != 0)
+ exit(1);
+
+ return ptr; /* { dg-bogus "uninitialized" } */
+}
+
+/* Make sure the uninit pass has something to do, add to the set of
+ disabled optimizations if not. */
+/* { dg-final { scan-tree-dump "# ptr_. = PHI" "uninit2" } } */