Committed to branch dmalcolm/jit: gcc/jit/ * internal-api.c (gcc::jit::playback::context::handle_locations): Add a disabled call to line_table_dump, in case it's handy for debugging in the future. (gcc::jit::playback::context::set_tree_location): Assert that the location is non-NULL. (gcc::jit::playback::location::location): Initialize m_src_loc to UNKNOWN_LOCATION. This field should always be overwritten by handle_locations before use, but given recent issues with bogus locations it seems safer to initialize it. --- gcc/jit/ChangeLog.jit | 12 ++++++++++++ gcc/jit/internal-api.c | 11 +++++++++++ 2 files changed, 23 insertions(+)
diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit index b0058b9..2298e49 100644 --- a/gcc/jit/ChangeLog.jit +++ b/gcc/jit/ChangeLog.jit @@ -1,3 +1,15 @@ +2014-03-07 David Malcolm <dmalc...@redhat.com> + + * internal-api.c (gcc::jit::playback::context::handle_locations): + Add a disabled call to line_table_dump, in case it's handy for + debugging in the future. + (gcc::jit::playback::context::set_tree_location): Assert that + the location is non-NULL. + (gcc::jit::playback::location::location): Initialize m_src_loc + to UNKNOWN_LOCATION. This field should always be overwritten by + handle_locations before use, but given recent issues with bogus + locations it seems safer to initialize it. + 2014-03-06 David Malcolm <dmalc...@redhat.com> * internal-api.c (gcc::jit::recording::context:: diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c index f80c40b..1cb15ce 100644 --- a/gcc/jit/internal-api.c +++ b/gcc/jit/internal-api.c @@ -3723,6 +3723,15 @@ handle_locations () linemap_add (line_table, LC_LEAVE, false, NULL, 0); } + /* line_table should now be populated; every playback::location should + now have an m_srcloc. */ + + if (0) + line_table_dump (stderr, + line_table, + LINEMAPS_ORDINARY_USED (line_table), + LINEMAPS_MACRO_USED (line_table)); + /* Now assign them to tree nodes as appropriate. */ std::pair<tree, location *> *cached_location; @@ -3822,6 +3831,7 @@ void playback::context:: set_tree_location (tree t, location *loc) { + gcc_assert (loc); m_cached_locations.safe_push (std::make_pair (t, loc)); } @@ -3899,6 +3909,7 @@ get_location (int column_num) } playback::location::location (source_line *line, int column_num) : + m_srcloc (UNKNOWN_LOCATION), m_line (line), m_column_num(column_num) { -- 1.7.11.7