+2020-01-14 David Malcolm <dmalcolm@redhat.com>
+
+ * supergraph.cc (supernode::dump_dot): Ensure that the TABLE
+ element has at least one TR.
+
2020-01-14 David Malcolm <dmalcolm@redhat.com>
PR analyzer/58237
pp_string (pp, "<TABLE BORDER=\"0\">");
pp_write_text_to_stream (pp);
+ bool had_row = false;
+
if (m_returning_call)
{
gv->begin_tr ();
if (args.m_node_annotator)
args.m_node_annotator->add_stmt_annotations (gv, m_returning_call);
pp_newline (pp);
+
+ had_row = true;
}
if (entry_p ())
{
pp_string (pp, "<TR><TD>ENTRY</TD></TR>");
pp_newline (pp);
+ had_row = true;
}
if (return_p ())
{
pp_string (pp, "<TR><TD>EXIT</TD></TR>");
pp_newline (pp);
+ had_row = true;
}
/* Phi nodes. */
args.m_node_annotator->add_stmt_annotations (gv, stmt);
pp_newline (pp);
+ had_row = true;
}
/* Statements. */
args.m_node_annotator->add_stmt_annotations (gv, stmt);
pp_newline (pp);
+ had_row = true;
+ }
+
+ /* Graphviz requires a TABLE element to have at least one TR
+ (and each TR to have at least one TD). */
+ if (!had_row)
+ {
+ pp_string (pp, "<TR><TD>(empty)</TD></TR>");
+ pp_newline (pp);
}
pp_string (pp, "</TABLE>>];\n\n");
+2020-01-14 David Malcolm <dmalcolm@redhat.com>
+
+ * gcc.dg/analyzer/dot-output.c: Add test coverage for a BB with
+ no statements.
+
2020-01-14 David Malcolm <dmalcolm@redhat.com>
PR analyzer/58237
return result;
}
+/* Test that we can generate valid .dot files given a BB with no
+ statements. */
+extern int func ();
+int test_2 (void)
+{
+ int c1;
+ do
+ {
+ c1 = func ();
+ if (c1 == '\0')
+ break;
+ }
+ while (c1);
+ return c1;
+}
+
/* { dg-final { dg-check-dot "dot-output.c.callgraph.dot" } } */
/* { dg-final { dg-check-dot "dot-output.c.eg.dot" } } */
/* { dg-final { dg-check-dot "dot-output.c.state-purge.dot" } } */