+2018-11-19 David Malcolm <dmalcolm@redhat.com>
+
+ PR tree-optimization/87025
+ * dumpfile.c (dump_context::begin_scope): Call end_any_optinfo
+ immediately after creating the scope optinfo.
+ (selftest::test_pr87025): New function.
+ (selftest::dumpfile_c_tests): Call it.
+ * optinfo-emit-json.cc (optrecord_json_writer::pop_scope): Assert
+ that we're not popping the top-level records array.
+ * optinfo.cc (optinfo::handle_dump_file_kind): Assert that we're
+ not changing the kind of a "scope" optinfo.
+
2018-11-19 David Malcolm <dmalcolm@redhat.com>
PR tree-optimization/87025
optinfo &info = begin_next_optinfo (loc);
info.m_kind = OPTINFO_KIND_SCOPE;
info.add_item (item);
+ end_any_optinfo ();
}
else
delete item;
}
}
+static void
+test_pr87025 ()
+{
+ dump_user_location_t loc
+ = dump_user_location_t::from_location_t (UNKNOWN_LOCATION);
+
+ temp_dump_context tmp (true, true,
+ MSG_ALL_KINDS | MSG_PRIORITY_USER_FACING);
+ {
+ AUTO_DUMP_SCOPE ("outer scope", loc);
+ dump_printf (MSG_NOTE, "msg1\n");
+ }
+}
+
/* Run all of the selftests within this file. */
void
{
test_impl_location ();
for_each_line_table_case (test_capture_of_dump_calls);
+ test_pr87025 ();
}
} // namespace selftest
optrecord_json_writer::pop_scope ()
{
m_scopes.pop ();
+
+ /* We should never pop the top-level records array. */
+ gcc_assert (m_scopes.length () > 0);
}
/* Create a JSON object representing LOC. */
void
optinfo::handle_dump_file_kind (dump_flags_t dump_kind)
{
+ /* Any optinfo for a "scope" should have been emitted separately. */
+ gcc_assert (m_kind != OPTINFO_KIND_SCOPE);
+
if (dump_kind & MSG_OPTIMIZED_LOCATIONS)
m_kind = OPTINFO_KIND_SUCCESS;
else if (dump_kind & MSG_MISSED_OPTIMIZATION)
+2018-11-19 David Malcolm <dmalcolm@redhat.com>
+
+ PR tree-optimization/87025
+ * gcc.dg/pr87025.c: New test.
+
2018-11-19 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/88071
--- /dev/null
+/* Ensure we don't ICE when tracking optimization record scopes within
+ the vectorizer. */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fsave-optimization-record -ftree-vectorize -fno-tree-scev-cprop -fno-tree-sink" } */
+
+void
+fk (unsigned int sf)
+{
+ for (;;)
+ {
+ if (sf != 0)
+ {
+ while (sf != 0)
+ ++sf;
+
+ while (sf < 8)
+ ++sf;
+ }
+
+ ++sf;
+ }
+}