https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115635
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- "make selftest-valgrind" is clean for me. Note that if you can reproducer this standalone, "make selftest-gdb" is a handy way to run the selftests under the debugger. FWIW, the output suggests that the assertion at line 1153 is failing: 1147 /* Verify that empty paths are handled gracefully. */ 1148 1149 static void 1150 test_empty_path (pretty_printer *event_pp) 1151 { 1152 test_diagnostic_path path (event_pp); ->1153 ASSERT_FALSE (path.interprocedural_p ()); 1154 "path" is empty i.e. num_events ought to be returning 0. Hence I'd expect diagnostic_path::interprocedural_p: 184 bool 185 diagnostic_path::interprocedural_p () const 186 { 187 /* Ignore leading events that are outside of any function. */ 188 unsigned first_fn_event_idx; 189 if (!get_first_event_in_a_function (&first_fn_event_idx)) 190 return false; to call get_first_event_in_a_function, and for that to get 0 for "num", and thus bail out with num == 0 again, never entering the loop here: 164 bool 165 diagnostic_path::get_first_event_in_a_function (unsigned *out_idx) const 166 { 167 const unsigned num = num_events (); 168 for (unsigned i = 0; i < num; i++) 169 { 170 const diagnostic_event &event = get_event (i); 171 if (const logical_location *logical_loc = event.get_logical_location ()) 172 if (logical_loc->function_p ()) 173 { 174 *out_idx = i; 175 return true; 176 } 177 } 178 return false; 179 } thus returning false to the callsite at line 189, and thus having diagnostic_path::interprocedural_p return false at line 190: 189 if (!get_first_event_in_a_function (&first_fn_event_idx)) 190 return false; So I'm not sure what's happening here (or maybe I'm missing something silly?)