]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/analyzer/ChangeLog
analyzer: improvements to diagnostic-manager.cc logging
[thirdparty/gcc.git] / gcc / analyzer / ChangeLog
CommitLineData
8f023575
DM
12020-03-27 David Malcolm <dmalcolm@redhat.com>
2
3 * diagnostic-manager.cc (dedupe_winners::add): Show the
4 exploded_node index in the log messages.
5 (diagnostic_manager::emit_saved_diagnostics): Log a summary of
6 m_saved_diagnostics at entry.
7
4d661bb7
DM
82020-03-27 David Malcolm <dmalcolm@redhat.com>
9
10 * supergraph.cc (superedge::dump): Add space before description;
11 move newline to non-pretty_printer overload.
12
884d9141
DM
132020-03-18 David Malcolm <dmalcolm@redhat.com>
14
15 * region-model.cc: Include "stor-layout.h".
16 (region_model::dump_to_pp): Rather than calling
17 dump_summary_of_map on each of the current frame and the globals,
18 instead get a vec of representative path_vars for all regions,
19 and then dump a summary of all of them.
20 (region_model::dump_summary_of_map): Delete, rewriting into...
21 (region_model::dump_summary_of_rep_path_vars): ...this new
22 function, working on a vec of path_vars.
23 (region_model::set_value): New overload.
24 (region_model::get_representative_path_var): Rename
25 "parent_region" local to "parent_reg" and consolidate with other
26 local. Guard test for grandparent being stack on parent_reg being
27 non-NULL. Move handling for parent being an array_region to
28 within guard for parent_reg being non-NULL.
29 (selftest::make_test_compound_type): New function.
30 (selftest::test_dump_2): New selftest.
31 (selftest::test_dump_3): New selftest.
32 (selftest::test_stack_frames): Update expected output from
33 simplified dump to show "a" and "b" from parent frame and "y" in
34 child frame.
35 (selftest::analyzer_region_model_cc_tests): Call test_dump_2 and
36 test_dump_3.
37 * region-model.h (region_model::set_value): New overload decl.
38 (region_model::dump_summary_of_map): Delete.
39 (region_model::dump_summary_of_rep_path_vars): New.
40
7d9c107a
DM
412020-03-18 David Malcolm <dmalcolm@redhat.com>
42
43 * region-model.h (class noop_region_model_context): New subclass
44 of region_model_context.
45 (class tentative_region_model_context): Inherit from
46 noop_region_model_context rather than from region_model_context;
47 drop redundant vfunc implementations.
48 (class test_region_model_context): Likewise.
49
0db2cd17
DM
502020-03-18 David Malcolm <dmalcolm@redhat.com>
51
52 * engine.cc (exploded_node::exploded_node): Move implementation
53 here from header; accept point_and_state by const reference rather
54 than by value.
55 * exploded-graph.h (exploded_node::exploded_node): Pass
56 point_and_state by const reference rather than by value. Move
57 body to engine.cc.
58
d5029d45
JJ
592020-03-18 Jakub Jelinek <jakub@redhat.com>
60
61 * sm-malloc.cc (malloc_state_machine::on_stmt): Fix up duplicated word
62 issue in a comment.
63 * region-model.cc (region_model::make_region_for_unexpected_tree_code,
64 region_model::delete_region_and_descendents): Likewise.
65 * engine.cc (class exploded_cluster): Likewise.
66 * diagnostic-manager.cc (class path_builder): Likewise.
67
5c048755
DM
682020-03-13 David Malcolm <dmalcolm@redhat.com>
69
70 PR analyzer/94099
71 PR analyzer/94105
72 * diagnostic-manager.cc (for_each_state_change): Bulletproof
73 against errors in get_rvalue by passing a
74 tentative_region_model_context and rejecting if there's an error.
75 * region-model.cc (region_model::get_lvalue_1): When handling
76 ARRAY_REF, handle results of error-handling. Handle NOP_EXPR.
77
90f7c300
DM
782020-03-06 David Malcolm <dmalcolm@redhat.com>
79
80 * analyzer.h (class array_region): New forward decl.
81 * program-state.cc (selftest::test_program_state_dumping_2): New.
82 (selftest::analyzer_program_state_cc_tests): Call it.
83 * region-model.cc (array_region::constant_from_key): New.
84 (region_model::get_representative_tree): Handle region_svalue by
85 generating an ADDR_EXPR.
86 (region_model::get_representative_path_var): In view handling,
87 remove erroneous TREE_TYPE when determining the type of the tree.
88 Handle array regions and STRING_CST.
89 (selftest::assert_dump_tree_eq): New.
90 (ASSERT_DUMP_TREE_EQ): New macro.
91 (selftest::test_get_representative_tree): New selftest.
92 (selftest::analyzer_region_model_cc_tests): Call it.
93 * region-model.h (region::dyn_cast_array_region): New vfunc.
94 (array_region::dyn_cast_array_region): New vfunc implementation.
95 (array_region::constant_from_key): New decl.
96
41f99ba6
DM
972020-03-06 David Malcolm <dmalcolm@redhat.com>
98
99 * analyzer.h (dump_quoted_tree): New decl.
100 * engine.cc (exploded_node::dump_dot): Pass region model to
101 sm_state_map::print.
102 * program-state.cc: Include diagnostic-core.h.
103 (sm_state_map::print): Add "model" param and use it to print
104 representative trees. Only print origin information if non-null.
105 (sm_state_map::dump): Pass NULL for model to print call.
106 (program_state::print): Pass region model to sm_state_map::print.
107 (program_state::dump_to_pp): Use spaces rather than newlines when
108 summarizing. Pass region_model to sm_state_map::print.
109 (ana::selftest::assert_dump_eq): New function.
110 (ASSERT_DUMP_EQ): New macro.
111 (ana::selftest::test_program_state_dumping): New function.
112 (ana::selftest::analyzer_program_state_cc_tests): Call it.
113 * program-state.h (program_state::print): Add model param.
114 * region-model.cc (dump_quoted_tree): New function.
115 (map_region::print_fields): Use dump_quoted_tree rather than
116 %qE to avoid lang-dependent output.
117 (map_region::dump_child_label): Likewise.
118 (region_model::dump_summary_of_map): For SK_REGION, when
119 get_representative_path_var fails, print the region id rather than
120 erroneously printing NULL.
121 * sm.cc (state_machine::get_state_by_name): New function.
122 * sm.h (state_machine::get_state_by_name): New decl.
123
3c1645a3
DM
1242020-03-04 David Malcolm <dmalcolm@redhat.com>
125
126 * region-model.cc (region::validate): Convert model param from ptr
127 to reference. Update comment to reflect that it's now a vfunc.
128 (map_region::validate): New vfunc implementation.
129 (array_region::validate): New vfunc implementation.
130 (stack_region::validate): New vfunc implementation.
131 (root_region::validate): New vfunc implementation.
132 (region_model::validate): Pass a reference rather than a pointer
133 to the region::validate vfunc.
134 * region-model.h (region::validate): Make virtual. Convert model
135 param from ptr to reference.
136 (map_region::validate): New vfunc decl.
137 (array_region::validate): New vfunc decl.
138 (stack_region::validate): New vfunc decl.
139 (root_region::validate): New vfunc decl.
140
e516294a
DM
1412020-03-04 David Malcolm <dmalcolm@redhat.com>
142
143 PR analyzer/93993
144 * region-model.cc (region_model::on_call_pre): Handle
145 BUILT_IN_EXPECT and its variants.
146 (region_model::add_any_constraints_from_ssa_def_stmt): Split out
147 gassign handling into add_any_constraints_from_gassign; add gcall
148 handling.
149 (region_model::add_any_constraints_from_gassign): New function,
150 based on the above. Add handling for NOP_EXPR.
151 (region_model::add_any_constraints_from_gcall): New function.
152 (region_model::get_representative_path_var): Handle views.
153 * region-model.h
154 (region_model::add_any_constraints_from_ssa_def_stmt): New decl.
155 (region_model::add_any_constraints_from_gassign): New decl.
156
3d66e153
DM
1572020-03-04 David Malcolm <dmalcolm@redhat.com>
158
159 PR analyzer/93993
160 * checker-path.h (state_change_event::get_lvalue): Add ctxt param
161 and pass it to region_model::get_value call.
162 * diagnostic-manager.cc (get_any_origin): Pass a
163 tentative_region_model_context to the calls to get_lvalue and reject
164 the comparison if errors occur.
165 (can_be_expr_of_interest_p): New function.
166 (diagnostic_manager::prune_for_sm_diagnostic): Replace checks for
167 CONSTANT_CLASS_P with calls to update_for_unsuitable_sm_exprs.
168 Pass a tentative_region_model_context to the calls to
169 state_change_event::get_lvalue and reject the comparison if errors
170 occur.
171 (diagnostic_manager::update_for_unsuitable_sm_exprs): New.
172 * diagnostic-manager.h
173 (diagnostic_manager::update_for_unsuitable_sm_exprs): New decl.
174 * region-model.h (class tentative_region_model_context): New class.
175
13e3ba14
DM
1762020-03-04 David Malcolm <dmalcolm@redhat.com>
177
178 * engine.cc (worklist::worklist): Remove unused field m_eg.
179 (class viz_callgraph_edge): Remove unused field m_call_sedge.
180 (class viz_callgraph): Remove unused field m_sg.
181 * exploded-graph.h (worklist::::m_eg): Remove unused field.
182
13b76912
DM
1832020-03-02 David Malcolm <dmalcolm@redhat.com>
184
185 * analyzer.opt (fanalyzer-show-duplicate-count): New option.
186 * diagnostic-manager.cc
187 (diagnostic_manager::emit_saved_diagnostic): Use the above to
188 guard the printing of the duplicate count.
189
9f00b22f
DM
1902020-03-02 David Malcolm <dmalcolm@redhat.com>
191
192 PR analyzer/93959
193 * analyzer.cc (is_std_function_p): New function.
194 (is_std_named_call_p): New functions.
195 * analyzer.h (is_std_named_call_p): New decl.
196 * sm-malloc.cc (malloc_state_machine::on_stmt): Check for "std::"
197 variants when checking for malloc, calloc and free.
198
71b633aa
DM
1992020-02-26 David Malcolm <dmalcolm@redhat.com>
200
201 PR analyzer/93950
202 * diagnostic-manager.cc
203 (diagnostic_manager::prune_for_sm_diagnostic): Assert that var is
204 either NULL or not a constant. When updating var, bulletproof
205 against constant values.
206
0ba70d1b
DM
2072020-02-26 David Malcolm <dmalcolm@redhat.com>
208
209 PR analyzer/93947
210 * region-model.cc (region_model::get_fndecl_for_call): Gracefully
211 fail for fn_decls that don't have a cgraph_node.
212
67fa274c
DM
2132020-02-26 David Malcolm <dmalcolm@redhat.com>
214
215 * bar-chart.cc: New file.
216 * bar-chart.h: New file.
217 * engine.cc: Include "analyzer/bar-chart.h".
218 (stats::log): Only log the m_num_nodes kinds that are non-zero.
219 (stats::dump): Likewise when dumping.
220 (stats::get_total_enodes): New.
221 (exploded_graph::get_or_create_node): Increment the per-point-data
222 m_excess_enodes when hitting the per-program-point limit on
223 enodes.
224 (exploded_graph::print_bar_charts): New.
225 (exploded_graph::log_stats): Log the number of unprocessed enodes
226 in the worklist. Call print_bar_charts.
227 (exploded_graph::dump_stats): Print the number of unprocessed
228 enodes in the worklist.
229 * exploded-graph.h (stats::get_total_enodes): New decl.
230 (struct per_program_point_data): Add field m_excess_enodes.
231 (exploded_graph::print_bar_charts): New decl.
232 * supergraph.cc (superedge::dump): New.
233 (superedge::dump): New.
234 * supergraph.h (supernode::get_function): New.
235 (superedge::dump): New decl.
236 (superedge::dump): New decl.
237
f2ca2088
DM
2382020-02-24 David Malcolm <dmalcolm@redhat.com>
239
240 * engine.cc (exploded_graph::get_or_create_node): Dump the
241 program_state to the pp, rather than to stderr.
242
b3d788a2
DM
2432020-02-24 David Malcolm <dmalcolm@redhat.com>
244
245 PR analyzer/93032
246 * sm.cc (make_checkers): Require the "taint" checker to be
247 explicitly enabled.
248
3a25f345
DM
2492020-02-24 David Malcolm <dmalcolm@redhat.com>
250
251 PR analyzer/93899
252 * engine.cc
253 (impl_region_model_context::impl_region_model_context): Add logger
254 param.
255 * engine.cc (exploded_graph::add_function_entry): Create an
256 impl_region_model_context and pass it to the push_frame call.
257 Bail if the resulting state is invalid.
258 (exploded_graph::build_initial_worklist): Likewise.
259 (exploded_graph::build_initial_worklist): Handle the case where
260 add_function_entry fails.
261 * exploded-graph.h
262 (impl_region_model_context::impl_region_model_context): Add logger
263 param.
264 * region-model.cc (map_region::get_or_create): Add ctxt param and
265 pass it to add_region_for_type.
266 (map_region::can_merge_p): Pass NULL as a ctxt to call to
267 get_or_create.
268 (array_region::get_element): Pass ctxt to call to get_or_create.
269 (array_region::get_or_create): Add ctxt param and pass it to
270 add_region_for_type.
271 (root_region::push_frame): Pass ctxt to get_or_create calls.
272 (region_model::get_lvalue_1): Likewise.
273 (region_model::make_region_for_unexpected_tree_code): Assert that
274 ctxt is non-NULL.
275 (region_model::get_rvalue_1): Pass ctxt to get_svalue_for_fndecl
276 and get_svalue_for_label calls.
277 (region_model::get_svalue_for_fndecl): Add ctxt param and pass it
278 to get_region_for_fndecl.
279 (region_model::get_region_for_fndecl): Add ctxt param and pass it
280 to get_or_create.
281 (region_model::get_svalue_for_label): Add ctxt param and pass it
282 to get_region_for_label.
283 (region_model::get_region_for_label): Add ctxt param and pass it
284 to get_region_for_fndecl and get_or_create.
285 (region_model::get_field_region): Add ctxt param and pass it to
286 get_or_create_view and get_or_create.
287 (make_region_for_type): Replace gcc_unreachable with return NULL.
288 (region_model::add_region_for_type): Add ctxt param. Handle a
289 return of NULL from make_region_for_type by calling
290 make_region_for_unexpected_tree_code.
291 (region_model::get_or_create_mem_ref): Pass ctxt to calls to
292 get_or_create_view.
293 (region_model::get_or_create_view): Add ctxt param and pass it to
294 add_region_for_type.
295 (selftest::test_state_merging): Pass ctxt to get_or_create_view.
296 * region-model.h (region_model::get_or_create): Add ctxt param.
297 (region_model::add_region_for_type): Likewise.
298 (region_model::get_svalue_for_fndecl): Likewise.
299 (region_model::get_svalue_for_label): Likewise.
300 (region_model::get_region_for_fndecl): Likewise.
301 (region_model::get_region_for_label): Likewise.
302 (region_model::get_field_region): Likewise.
303 (region_model::get_or_create_view): Likewise.
304
004f2c07
DM
3052020-02-24 David Malcolm <dmalcolm@redhat.com>
306
307 * checker-path.cc (superedge_event::should_filter_p): Update
308 filter for empty descriptions to cover verbosity level 3 as well
309 as 2.
310 * diagnostic-manager.cc: Include "analyzer/reachability.h".
311 (class path_builder): New class.
312 (diagnostic_manager::emit_saved_diagnostic): Create a path_builder
313 and pass it to build_emission_path, rather passing eg; similarly
314 for add_events_for_eedge and ext_state.
315 (diagnostic_manager::build_emission_path): Replace "eg" param
316 with a path_builder, pass it to add_events_for_eedge.
317 (diagnostic_manager::add_events_for_eedge): Replace ext_state
318 param with path_builder; pass it to add_events_for_superedge.
319 (diagnostic_manager::significant_edge_p): New.
320 (diagnostic_manager::add_events_for_superedge): Add path_builder
321 param. Reject insignificant edges at verbosity levels below 3.
322 (diagnostic_manager::prune_for_sm_diagnostic): Update highest
323 verbosity level to 4.
324 * diagnostic-manager.h (class path_builder): New forward decl.
325 (diagnostic_manager::build_emission_path): Replace "eg" param
326 with a path_builder.
327 (diagnostic_manager::add_events_for_eedge): Replace ext_state
328 param with path_builder.
329 (diagnostic_manager::significant_edge_p): New.
330 (diagnostic_manager::add_events_for_superedge): Add path_builder
331 param.
332 * reachability.h: New file.
333
0b2b45a6
DM
3342020-02-18 David Malcolm <dmalcolm@redhat.com>
335
336 PR analyzer/93692
337 * analyzer.opt (fdump-analyzer-callgraph): Rewrite description.
338
4f40164a
DM
3392020-02-18 David Malcolm <dmalcolm@redhat.com>
340
341 PR analyzer/93777
342 * region-model.cc (region_model::maybe_cast_1): Replace assertion
343 that build_cast returns non-NULL with a conditional, falling
344 through to the logic which returns a new unknown value of the
345 desired type if it fails.
346
2e623393
DM
3472020-02-18 David Malcolm <dmalcolm@redhat.com>
348
349 PR analyzer/93778
350 * engine.cc (impl_region_model_context::on_unknown_tree_code):
351 Rename to...
352 (impl_region_model_context::on_unexpected_tree_code): ...this and
353 convert first argument from path_var to tree.
354 (exploded_node::on_stmt): Pass ctxt to purge_for_unknown_fncall.
355 * exploded-graph.h (region_model_context::on_unknown_tree_code):
356 Rename to...
357 (region_model_context::on_unexpected_tree_code): ...this and
358 convert first argument from path_var to tree.
359 * program-state.cc (sm_state_map::purge_for_unknown_fncall): Add
360 ctxt param and pass on to calls to get_rvalue.
361 * program-state.h (sm_state_map::purge_for_unknown_fncall): Add
362 ctxt param.
363 * region-model.cc (region_model::handle_unrecognized_call): Pass
364 ctxt on to call to get_rvalue.
365 (region_model::get_lvalue_1): Move body of default case to
366 region_model::make_region_for_unexpected_tree_code and call it.
367 Within COMPONENT_REF case, reject attempts to handle types other
368 than RECORD_TYPE and UNION_TYPE.
369 (region_model::make_region_for_unexpected_tree_code): New
370 function, based on default case of region_model::get_lvalue_1.
371 * region-model.h
372 (region_model::make_region_for_unexpected_tree_code): New decl.
373 (region_model::on_unknown_tree_code): Rename to...
374 (region_model::on_unexpected_tree_code): ...this and convert first
375 argument from path_var to tree.
376 (class test_region_model_context): Update vfunc implementation for
377 above change.
378
a674c7b8
DM
3792020-02-18 David Malcolm <dmalcolm@redhat.com>
380
381 PR analyzer/93774
382 * region-model.cc
383 (region_model::convert_byte_offset_to_array_index): Use
384 int_size_in_bytes before calling size_in_bytes, to gracefully fail
385 on incomplete types.
386
d8cde6f9
DM
3872020-02-17 David Malcolm <dmalcolm@redhat.com>
388
389 PR analyzer/93775
390 * region-model.cc (region_model::get_fndecl_for_call): Handle the
391 case where the code_region's get_tree_for_child_region returns
392 NULL.
393
f76a88eb
DM
3942020-02-17 David Malcolm <dmalcolm@redhat.com>
395
396 PR analyzer/93388
397 * engine.cc (impl_region_model_context::on_unknown_tree_code):
398 New.
399 (exploded_graph::get_or_create_node): Reject invalid states.
400 * exploded-graph.h
401 (impl_region_model_context::on_unknown_tree_code): New decl.
402 (point_and_state::point_and_state): Assert that the state is
403 valid.
404 * program-state.cc (program_state::program_state): Initialize
405 m_valid to true.
406 (program_state::operator=): Copy m_valid.
407 (program_state::program_state): Likewise for move constructor.
408 (program_state::print): Print m_valid.
409 (program_state::dump_to_pp): Likewise.
410 * program-state.h (program_state::m_valid): New field.
411 * region-model.cc (region_model::get_lvalue_1): Implement the
412 default case by returning a new symbolic region and calling
413 the context's on_unknown_tree_code, rather than issuing an
414 internal_error. Implement VIEW_CONVERT_EXPR.
415 * region-model.h (region_model_context::on_unknown_tree_code): New
416 vfunc.
417 (test_region_model_context::on_unknown_tree_code): New.
418
0993ad65
DM
4192020-02-17 David Malcolm <dmalcolm@redhat.com>
420
421 * sm-malloc.cc (malloc_diagnostic::describe_state_change): For
422 transition to the "null" state, only say "assuming" when
423 transitioning from the "unchecked" state.
424
67098787
DM
4252020-02-17 David Malcolm <dmalcolm@redhat.com>
426
427 * diagnostic-manager.h (diagnostic_manager::get_saved_diagnostic):
428 Add const overload.
429 * engine.cc (exploded_node::dump_dot): Dump saved_diagnostics.
430 * exploded-graph.h (exploded_graph::get_diagnostic_manager): Add
431 const overload.
432
91f993b7
DM
4332020-02-11 David Malcolm <dmalcolm@redhat.com>
434
435 PR analyzer/93288
436 * analysis-plan.cc (analysis_plan::use_summary_p): Look through
437 the ultimate_alias_target when getting the called function.
438 * engine.cc (exploded_node::on_stmt): Rename second "ctxt" to
439 "sm_ctxt". Use the region_model's get_fndecl_for_call rather than
440 gimple_call_fndecl.
441 * region-model.cc (region_model::get_fndecl_for_call): Use
442 ultimate_alias_target on fndecl.
443 * supergraph.cc (get_ultimate_function_for_cgraph_edge): New
444 function.
445 (supergraph_call_edge): Use it when rejecting edges without
446 functions.
447 (supergraph::supergraph): Use it to get the function for the
448 cgraph_edge when building interprocedural superedges.
449 (callgraph_superedge::get_callee_function): Use it.
450 * supergraph.h (supergraph::get_num_snodes): Make param const.
451 (supergraph::function_to_num_snodes_t): Make first type param
452 const.
453
a60d9889
DM
4542020-02-11 David Malcolm <dmalcolm@redhat.com>
455
456 PR analyzer/93374
457 * engine.cc (exploded_edge::exploded_edge): Add ext_state param
458 and pass it to change.validate.
459 (exploded_graph::get_or_create_node): Move purging of change
460 svalues to also cover the case of reusing an existing enode.
461 (exploded_graph::add_edge): Pass m_ext_state to exploded_edge's
462 ctor.
463 * exploded-graph.h (exploded_edge::exploded_edge): Add ext_state
464 param.
465 * program-state.cc (state_change::sm_change::validate): Likewise.
466 Assert that m_sm_idx is sane. Use ext_state to validate
467 m_old_state and m_new_state.
468 (state_change::validate): Add ext_state param and pass it to
469 the sm_change validate calls.
470 * program-state.h (state_change::sm_change::validate): Add
471 ext_state param.
472 (state_change::validate): Likewise.
473
a0e4929b
DM
4742020-02-11 David Malcolm <dmalcolm@redhat.com>
475
476 PR analyzer/93669
477 * engine.cc (exploded_graph::dump_exploded_nodes): Handle missing
478 case of STATUS_WORKLIST in implementation of
479 "__analyzer_dump_exploded_nodes".
480
cd28b759
DM
4812020-02-11 David Malcolm <dmalcolm@redhat.com>
482
483 PR analyzer/93649
484 * constraint-manager.cc (constraint_manager::add_constraint): When
485 merging equivalence classes and updating m_constant, also update
486 m_cst_sid.
487 (constraint_manager::validate): If m_constant is non-NULL assert
488 that m_cst_sid is non-null and is valid.
489
5e17c1bd
DM
4902020-02-11 David Malcolm <dmalcolm@redhat.com>
491
492 PR analyzer/93657
493 * analyzer.opt (fdump-analyzer): Reword description.
494 (fdump-analyzer-stderr): Likewise.
495
c46d057f
DM
4962020-02-11 David Malcolm <dmalcolm@redhat.com>
497
498 * region-model.cc (print_quoted_type): New function.
499 (svalue::print): Use it to replace %qT.
500 (region::dump_to_pp): Likewise.
501 (region::dump_child_label): Likewise.
502 (region::print_fields): Likewise.
503
eb031d4b
DM
5042020-02-10 David Malcolm <dmalcolm@redhat.com>
505
506 PR analyzer/93659
507 * analyzer.opt (-param=analyzer-max-recursion-depth=): Fix "tha"
508 -> "that" typo.
509 (Wanalyzer-use-of-uninitialized-value): Fix "initialized" ->
510 "uninitialized" typo.
511
e87deb37
DM
5122020-02-10 David Malcolm <dmalcolm@redhat.com>
513
514 PR analyzer/93350
515 * region-model.cc (region_model::get_lvalue_1):
516 Handle BIT_FIELD_REF.
517 (make_region_for_type): Handle VECTOR_TYPE.
518
e953f958
DM
5192020-02-10 David Malcolm <dmalcolm@redhat.com>
520
521 PR analyzer/93647
522 * diagnostic-manager.cc
523 (diagnostic_manager::prune_for_sm_diagnostic): Bulletproof against
524 VAR being constant.
525 * region-model.cc (region_model::get_lvalue_1): Provide a better
526 error message when encountering an unhandled tree code.
527
41a9e940
DM
5282020-02-10 David Malcolm <dmalcolm@redhat.com>
529
530 PR analyzer/93405
531 * region-model.cc (region_model::get_lvalue_1): Implement
532 CONST_DECL.
533
cb273d81
DM
5342020-02-06 David Malcolm <dmalcolm@redhat.com>
535
536 * region-model.cc (region_model::maybe_cast_1): Attempt to provide
537 a region_svalue if either type is a pointer, rather than if both
538 types are pointers.
539
a4d3bfc0
DM
5402020-02-05 David Malcolm <dmalcolm@redhat.com>
541
542 * engine.cc (exploded_node::dump_dot): Show merger enodes.
543 (worklist::add_node): Assert that the node's m_status is
544 STATUS_WORKLIST.
545 (exploded_graph::process_worklist): Likewise for nodes from the
546 worklist. Set status of merged nodes to STATUS_MERGER.
547 (exploded_graph::process_node): Set status of node to
548 STATUS_PROCESSED.
549 (exploded_graph::dump_exploded_nodes): Rework handling of
550 "__analyzer_dump_exploded_nodes", splitting enodes by status into
551 "processed" and "merger", showing the count of just the processed
552 enodes at the call, rather than the count of all enodes.
553 * exploded-graph.h (exploded_node::status): New enum.
554 (exploded_node::exploded_node): Initialize m_status to
555 STATUS_WORKLIST.
556 (exploded_node::get_status): New getter.
557 (exploded_node::set_status): New setter.
558
1dae549d
DM
5592020-02-04 David Malcolm <dmalcolm@redhat.com>
560
561 PR analyzer/93543
562 * engine.cc (pod_hash_traits<function_call_string>::mark_empty):
563 Eliminate reinterpret_cast.
564 (pod_hash_traits<function_call_string>::is_empty): Likewise.
565
833f1e66
DM
5662020-02-03 David Malcolm <dmalcolm@redhat.com>
567
568 * constraint-manager.cc (range::constrained_to_single_element):
569 Replace fold_build2 with fold_binary. Remove unnecessary newline.
570 (constraint_manager::get_or_add_equiv_class): Replace fold_build2
571 with fold_binary in two places, and remove out-of-date comment.
572 (constraint_manager::eval_condition): Replace fold_build2 with
573 fold_binary.
574 * region-model.cc (constant_svalue::eval_condition): Likewise.
575 (region_model::on_assignment): Likewise.
576
8525d1f5
DM
5772020-02-03 David Malcolm <dmalcolm@redhat.com>
578
579 PR analyzer/93544
580 * diagnostic-manager.cc
581 (diagnostic_manager::prune_for_sm_diagnostic): Bulletproof
582 against bad choices due to bad paths.
583 * engine.cc (impl_region_model_context::on_phi): New.
584 * exploded-graph.h (impl_region_model_context::on_phi): New decl.
585 * region-model.cc (region_model::on_longjmp): Likewise.
586 (region_model::handle_phi): Add phi param. Call the ctxt's on_phi
587 vfunc.
588 (region_model::update_for_phis): Pass phi to handle_phi.
589 * region-model.h (region_model::handle_phi): Add phi param.
590 (region_model_context::on_phi): New vfunc.
591 (test_region_model_context::on_phi): New.
592 * sm-malloc.cc (malloc_state_machine::on_phi): New.
593 (malloc_state_machine::on_zero_assignment): New.
594 * sm.h (state_machine::on_phi): New vfunc.
595
73f38658
DM
5962020-02-03 David Malcolm <dmalcolm@redhat.com>
597
598 * engine.cc (supernode_cluster::dump_dot): Show BB index as
599 well as SN index.
600 * supergraph.cc (supernode::dump_dot): Likewise.
601
5e10b9a2
DM
6022020-02-03 David Malcolm <dmalcolm@redhat.com>
603
604 PR analyzer/93546
605 * region-model.cc (region_model::on_call_pre): Update for new
606 param of symbolic_region ctor.
607 (region_model::deref_rvalue): Likewise.
608 (region_model::add_new_malloc_region): Likewise.
609 (make_region_for_type): Likewise, preserving type.
610 * region-model.h (symbolic_region::symbolic_region): Add "type"
611 param and pass it to base class ctor.
612
287ccd3b
DM
6132020-02-03 David Malcolm <dmalcolm@redhat.com>
614
615 PR analyzer/93547
616 * constraint-manager.cc
617 (constraint_manager::get_or_add_equiv_class): Ensure types are
618 compatible before comparing constants.
619
67751724
DM
6202020-01-31 David Malcolm <dmalcolm@redhat.com>
621
622 PR analyzer/93457
623 * region-model.cc (make_region_for_type): Use VOID_TYPE_P rather
624 than checking against void_type_node.
625
09bea584
DM
6262020-01-31 David Malcolm <dmalcolm@redhat.com>
627
628 PR analyzer/93373
629 * region-model.cc (ASSERT_COMPAT_TYPES): Convert to...
630 (assert_compat_types): ...this, and bail when either type is NULL,
631 or when VOID_TYPE_P (dst_type).
632 (region_model::get_lvalue): Update for above conversion.
633 (region_model::get_rvalue): Likewise.
634
f1c807e8
DM
6352020-01-31 David Malcolm <dmalcolm@redhat.com>
636
637 PR analyzer/93379
638 * region-model.cc (region_model::update_for_return_superedge):
639 Move check for null result so that it also guards setting the
640 lhs.
641
455f58ec
DM
6422020-01-31 David Malcolm <dmalcolm@redhat.com>
643
644 PR analyzer/93438
645 * region-model.cc (stack_region::can_merge_p): Split into a two
646 pass approach, creating all stack regions first, then populating
647 them.
648 (selftest::test_state_merging): Add test coverage for (a) the case
649 of self-merging a model in which a local in an older stack frame
650 points to a local in a more recent stack frame (which previously
651 would ICE), and (b) the case of self-merging a model in which a
652 local points to a global (which previously worked OK).
653
182ce042
DM
6542020-01-31 David Malcolm <dmalcolm@redhat.com>
655
656 * analyzer.cc (is_named_call_p): Replace tests for fndecl being
657 extern at file scope and having a non-NULL DECL_NAME with a call
658 to maybe_special_function_p.
659 * function-set.cc (function_set::contains_decl_p): Add call to
660 maybe_special_function_p.
661
45eb3e49
DM
6622020-01-31 David Malcolm <dmalcolm@redhat.com>
663
664 PR analyzer/93450
665 * constraint-manager.cc
666 (constraint_manager::get_or_add_equiv_class): Only compare constants
667 if their types are compatible.
668 * region-model.cc (constant_svalue::eval_condition): Replace check
669 for identical types with call to types_compatible_p.
670
42f36563
DM
6712020-01-30 David Malcolm <dmalcolm@redhat.com>
672
673 * program-state.cc (extrinsic_state::dump_to_pp): New.
674 (extrinsic_state::dump_to_file): New.
675 (extrinsic_state::dump): New.
676 * program-state.h (extrinsic_state::dump_to_pp): New decl.
677 (extrinsic_state::dump_to_file): New decl.
678 (extrinsic_state::dump): New decl.
679 * sm.cc: Include "pretty-print.h".
680 (state_machine::dump_to_pp): New.
681 * sm.h (state_machine::dump_to_pp): New decl.
682
ebe9174e
DM
6832020-01-30 David Malcolm <dmalcolm@redhat.com>
684
685 * diagnostic-manager.cc (for_each_state_change): Use
686 extrinsic_state::get_num_checkers rather than accessing m_checkers
687 directly.
688 * program-state.cc (program_state::program_state): Likewise.
689 * program-state.h (extrinsic_state::m_checkers): Make private.
690
e978955d
DM
6912020-01-30 David Malcolm <dmalcolm@redhat.com>
692
693 PR analyzer/93356
694 * region-model.cc (region_model::eval_condition): In both
695 overloads, bail out immediately on floating-point types.
696 (region_model::eval_condition_without_cm): Likewise.
697 (region_model::add_constraint): Likewise.
698
d177c49c
DM
6992020-01-30 David Malcolm <dmalcolm@redhat.com>
700
701 PR analyzer/93450
702 * program-state.cc (sm_state_map::set_state): For the overload
703 taking an svalue_id, bail out if the set_state on the ec does
704 nothing. Convert the latter's return type from void to bool,
705 returning true if anything changed.
706 (sm_state_map::impl_set_state): Convert the return type from void
707 to bool, returning true if the state changed.
708 * program-state.h (sm_state_map::set_state): Convert return type
709 from void to bool.
710 (sm_state_map::impl_set_state): Likewise.
711 * region-model.cc (constant_svalue::eval_condition): Only call
712 fold_build2 if the types are the same.
713
7892ff37
JJ
7142020-01-29 Jakub Jelinek <jakub@redhat.com>
715
716 * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Remove.
717 * constraint-manager.cc: Include diagnostic-core.h before graphviz.h.
718 (range::dump, equiv_class::print): Don't use PUSH_IGNORE_WFORMAT or
719 POP_IGNORE_WFORMAT.
720 * state-purge.cc: Include diagnostic-core.h before
721 gimple-pretty-print.h.
722 (state_purge_annotator::add_node_annotations, print_vec_of_names):
723 Don't use PUSH_IGNORE_WFORMAT or POP_IGNORE_WFORMAT.
724 * region-model.cc: Move diagnostic-core.h include before graphviz.h.
725 (path_var::dump, svalue::print, constant_svalue::print_details,
726 region::dump_to_pp, region::dump_child_label, region::print_fields,
727 map_region::print_fields, map_region::dump_dot_to_pp,
728 map_region::dump_child_label, array_region::print_fields,
729 array_region::dump_dot_to_pp): Don't use PUSH_IGNORE_WFORMAT or
730 POP_IGNORE_WFORMAT.
731
5aebfb71
DM
7322020-01-28 David Malcolm <dmalcolm@redhat.com>
733
734 PR analyzer/93316
735 * engine.cc (rewind_info_t::update_model): Get the longjmp call
736 stmt via get_longjmp_call () rather than assuming it is the last
737 stmt in the longjmp's supernode.
738 (rewind_info_t::add_events_to_path): Get the location_t for the
739 rewind_from_longjmp_event via get_longjmp_call () rather than from
740 the supernode's get_end_location ().
741
6c8e5844
DM
7422020-01-28 David Malcolm <dmalcolm@redhat.com>
743
744 * region-model.cc (poisoned_value_diagnostic::emit): Update for
745 renaming of warning_at overload to warning_meta.
746 * sm-file.cc (file_leak::emit): Likewise.
747 * sm-malloc.cc (double_free::emit): Likewise.
748 (possible_null_deref::emit): Likewise.
749 (possible_null_arg::emit): Likewise.
750 (null_deref::emit): Likewise.
751 (null_arg::emit): Likewise.
752 (use_after_free::emit): Likewise.
753 (malloc_leak::emit): Likewise.
754 (free_of_non_heap::emit): Likewise.
755 * sm-sensitive.cc (exposure_through_output_file::emit): Likewise.
756 * sm-signal.cc (signal_unsafe_call::emit): Likewise.
757 * sm-taint.cc (tainted_array_index::emit): Likewise.
758
8c08c983
DM
7592020-01-27 David Malcolm <dmalcolm@redhat.com>
760
761 PR analyzer/93451
762 * region-model.cc (tree_cmp): For the REAL_CST case, impose an
763 arbitrary order on NaNs relative to other NaNs and to non-NaNs;
764 const-correctness tweak.
765 (ana::selftests::build_real_cst_from_string): New function.
766 (ana::selftests::append_interesting_constants): New function.
767 (ana::selftests::test_tree_cmp_on_constants): New test.
768 (ana::selftests::test_canonicalization_4): New test.
769 (ana::selftests::analyzer_region_model_cc_tests): Call the new
770 tests.
771
2fbea419
DM
7722020-01-27 David Malcolm <dmalcolm@redhat.com>
773
774 PR analyzer/93349
775 * engine.cc (run_checkers): Save and restore input_location.
776
6a81cabc
DM
7772020-01-27 David Malcolm <dmalcolm@redhat.com>
778
779 * call-string.cc (call_string::cmp_1): Delete, moving body to...
780 (call_string::cmp): ...here.
781 * call-string.h (call_string::cmp_1): Delete decl.
782 * engine.cc (worklist::key_t::cmp_1): Delete, moving body to...
783 (worklist::key_t::cmp): ...here. Implement hash comparisons
784 via comparison rather than subtraction to avoid overflow issues.
785 * exploded-graph.h (worklist::key_t::cmp_1): Delete decl.
786 * region-model.cc (tree_cmp): Eliminate buggy checking for
787 symmetry.
788
342e14ff
DM
7892020-01-27 David Malcolm <dmalcolm@redhat.com>
790
791 * analyzer.cc (is_named_call_p): Check that fndecl is "extern"
792 and at file scope. Potentially disregard prefix _ or __ in
793 fndecl's name. Bail if the identifier is NULL.
794 (is_setjmp_call_p): Expect a gcall rather than plain gimple.
795 Remove special-case check for leading prefix, and also check for
796 sigsetjmp.
797 (is_longjmp_call_p): Also check for siglongjmp.
798 (get_user_facing_name): New function.
799 * analyzer.h (is_setjmp_call_p): Expect a gcall rather than plain
800 gimple.
801 (get_user_facing_name): New decl.
802 * checker-path.cc (setjmp_event::get_desc): Use
803 get_user_facing_name to avoid hardcoding the function name.
804 (rewind_event::rewind_event): Add rewind_info param, using it to
805 initialize new m_rewind_info field, and strengthen the assertion.
806 (rewind_from_longjmp_event::get_desc): Use get_user_facing_name to
807 avoid hardcoding the function name.
808 (rewind_to_setjmp_event::get_desc): Likewise.
809 * checker-path.h (setjmp_event::setjmp_event): Add setjmp_call
810 param and use it to initialize...
811 (setjmp_event::m_setjmp_call): New field.
812 (rewind_event::rewind_event): Add rewind_info param.
813 (rewind_event::m_rewind_info): New protected field.
814 (rewind_from_longjmp_event::rewind_from_longjmp_event): Add
815 rewind_info param.
816 (class rewind_to_setjmp_event): Move rewind_info field to parent
817 class.
818 * diagnostic-manager.cc (diagnostic_manager::add_events_for_eedge):
819 Update setjmp-handling for is_setjmp_call_p requiring a gcall;
820 pass the call to the new setjmp_event.
821 * engine.cc (exploded_node::on_stmt): Update for is_setjmp_call_p
822 requiring a gcall.
823 (stale_jmp_buf::emit): Use get_user_facing_name to avoid
824 hardcoding the function names.
825 (exploded_node::on_longjmp): Pass the longjmp_call when
826 constructing rewind_info.
827 (rewind_info_t::add_events_to_path): Pass the rewind_info_t to the
828 rewind_from_longjmp_event's ctor.
829 * exploded-graph.h (rewind_info_t::rewind_info_t): Add
830 longjmp_call param.
831 (rewind_info_t::get_longjmp_call): New.
832 (rewind_info_t::m_longjmp_call): New.
833 * region-model.cc (region_model::on_setjmp): Update comment to
834 indicate this is also for sigsetjmp.
835 * region-model.h (struct setjmp_record): Likewise.
836 (class setjmp_svalue): Likewise.
837
26d949c8
DM
8382020-01-27 David Malcolm <dmalcolm@redhat.com>
839
840 PR analyzer/93276
841 * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Guard these
842 macros with GCC_VERSION >= 4006, making them no-op otherwise.
843 * engine.cc (exploded_edge::exploded_edge): Specify template for
844 base class initializer.
845 (exploded_graph::add_edge): Specify template when chaining up to
846 base class add_edge implementation.
847 (viz_callgraph_node::dump_dot): Drop redundant "typename".
848 (viz_callgraph_edge::viz_callgraph_edge): Specify template for
849 base class initializer.
850 * program-state.cc (sm_state_map::clone_with_remapping): Drop
851 redundant "typename".
852 (sm_state_map::print): Likewise.
853 (sm_state_map::hash): Likewise.
854 (sm_state_map::operator==): Likewise.
855 (sm_state_map::remap_svalue_ids): Likewise.
856 (sm_state_map::on_svalue_purge): Likewise.
857 (sm_state_map::validate): Likewise.
858 * program-state.h (sm_state_map::iterator_t): Likewise.
859 * supergraph.h (superedge::superedge): Specify template for base
860 class initializer.
861
648796da
DM
8622020-01-23 David Malcolm <dmalcolm@redhat.com>
863
864 PR analyzer/93375
865 * supergraph.cc (callgraph_superedge::get_arg_for_parm): Fail
866 gracefully is the number of parameters at the callee exceeds the
867 number of arguments at the call stmt.
868 (callgraph_superedge::get_parm_for_arg): Likewise.
869
591b59eb
DM
8702020-01-22 David Malcolm <dmalcolm@redhat.com>
871
872 PR analyzer/93382
873 * program-state.cc (sm_state_map::on_svalue_purge): If the
874 entry survives, but the origin is being purged, then reset the
875 origin to null.
876
c9c8aef4
DM
8772020-01-22 David Malcolm <dmalcolm@redhat.com>
878
879 * sm-signal.cc: Fix nesting of CHECKING_P and namespace ana.
880
fd9982bb
DM
8812020-01-22 David Malcolm <dmalcolm@redhat.com>
882
883 PR analyzer/93378
884 * engine.cc (setjmp_svalue::compare_fields): Update for
885 replacement of m_enode with m_setjmp_record.
886 (setjmp_svalue::add_to_hash): Likewise.
887 (setjmp_svalue::get_index): Rename...
888 (setjmp_svalue::get_enode_index): ...to this.
889 (setjmp_svalue::print_details): Update for replacement of m_enode
890 with m_setjmp_record.
891 (exploded_node::on_longjmp): Likewise.
892 * exploded-graph.h (rewind_info_t::m_enode_origin): Replace...
893 (rewind_info_t::m_setjmp_record): ...with this.
894 (rewind_info_t::rewind_info_t): Update for replacement of m_enode
895 with m_setjmp_record.
896 (rewind_info_t::get_setjmp_point): Likewise.
897 (rewind_info_t::get_setjmp_call): Likewise.
898 * region-model.cc (region_model::dump_summary_of_map): Likewise.
899 (region_model::on_setjmp): Likewise.
900 * region-model.h (struct setjmp_record): New struct.
901 (setjmp_svalue::m_enode): Replace...
902 (setjmp_svalue::m_setjmp_record): ...with this.
903 (setjmp_svalue::setjmp_svalue): Update for replacement of m_enode
904 with m_setjmp_record.
905 (setjmp_svalue::clone): Likewise.
906 (setjmp_svalue::get_index): Rename...
907 (setjmp_svalue::get_enode_index): ...to this.
908 (setjmp_svalue::get_exploded_node): Replace...
909 (setjmp_svalue::get_setjmp_record): ...with this.
910
da7cf663
DM
9112020-01-22 David Malcolm <dmalcolm@redhat.com>
912
913 PR analyzer/93316
914 * analyzer.cc (is_setjmp_call_p): Check for "setjmp" as well as
915 "_setjmp".
916
75038aa6
DM
9172020-01-22 David Malcolm <dmalcolm@redhat.com>
918
919 PR analyzer/93307
920 * analysis-plan.h: Wrap everything namespace "ana".
921 * analyzer-logging.cc: Likewise.
922 * analyzer-logging.h: Likewise.
923 * analyzer-pass.cc (pass_analyzer::execute): Update for "ana"
924 namespace.
925 * analyzer-selftests.cc: Wrap everything namespace "ana".
926 * analyzer-selftests.h: Likewise.
927 * analyzer.h: Likewise for forward decls of types.
928 * call-string.h: Likewise.
929 * checker-path.cc: Likewise.
930 * checker-path.h: Likewise.
931 * constraint-manager.cc: Likewise.
932 * constraint-manager.h: Likewise.
933 * diagnostic-manager.cc: Likewise.
934 * diagnostic-manager.h: Likewise.
935 * engine.cc: Likewise.
936 * engine.h: Likewise.
937 * exploded-graph.h: Likewise.
938 * function-set.cc: Likewise.
939 * function-set.h: Likewise.
940 * pending-diagnostic.cc: Likewise.
941 * pending-diagnostic.h: Likewise.
942 * program-point.cc: Likewise.
943 * program-point.h: Likewise.
944 * program-state.cc: Likewise.
945 * program-state.h: Likewise.
946 * region-model.cc: Likewise.
947 * region-model.h: Likewise.
948 * sm-file.cc: Likewise.
949 * sm-malloc.cc: Likewise.
950 * sm-pattern-test.cc: Likewise.
951 * sm-sensitive.cc: Likewise.
952 * sm-signal.cc: Likewise.
953 * sm-taint.cc: Likewise.
954 * sm.cc: Likewise.
955 * sm.h: Likewise.
956 * state-purge.h: Likewise.
957 * supergraph.cc: Likewise.
958 * supergraph.h: Likewise.
959
4f01e577
DM
9602020-01-21 David Malcolm <dmalcolm@redhat.com>
961
962 PR analyzer/93352
963 * region-model.cc (int_cmp): Rename to...
964 (array_region::key_cmp): ...this, using key_t rather than int.
965 Rewrite in terms of comparisons rather than subtraction to
966 ensure qsort is anti-symmetric when handling extreme values.
967 (array_region::walk_for_canonicalization): Update for above
968 renaming.
969 * region-model.h (array_region::key_cmp): New decl.
970
07c86323
DM
9712020-01-17 David Malcolm <dmalcolm@redhat.com>
972
973 PR analyzer/93290
974 * region-model.cc (region_model::eval_condition_without_cm): Avoid
975 gcc_unreachable for unexpected operations for the case where
976 we're comparing an svalue against itself.
977
5f030383
DM
9782020-01-17 David Malcolm <dmalcolm@redhat.com>
979
980 PR analyzer/93281
981 * region-model.cc
982 (region_model::convert_byte_offset_to_array_index): Convert to
983 ssizetype before dividing by byte_size. Use fold_binary rather
984 than fold_build2 to avoid needlessly constructing a tree for the
985 non-const case.
986
49e9a999
DM
9872020-01-15 David Malcolm <dmalcolm@redhat.com>
988
989 * engine.cc (class impl_region_model_context): Fix comment.
990
32077b69
DM
9912020-01-14 David Malcolm <dmalcolm@redhat.com>
992
993 PR analyzer/93212
994 * region-model.cc (make_region_for_type): Use
995 FUNC_OR_METHOD_TYPE_P rather than comparing against FUNCTION_TYPE.
996 * region-model.h (function_region::function_region): Likewise.
997
7fb3669e
DM
9982020-01-14 David Malcolm <dmalcolm@redhat.com>
999
1000 * program-state.cc (sm_state_map::clone_with_remapping): Copy
1001 m_global_state.
1002 (selftest::test_program_state_merging_2): New selftest.
1003 (selftest::analyzer_program_state_cc_tests): Call it.
1004
e2a538b1
DM
10052020-01-14 David Malcolm <dmalcolm@redhat.com>
1006
1007 * checker-path.h (checker_path::get_checker_event): New function.
1008 (checker_path): Add DISABLE_COPY_AND_ASSIGN; make fields private.
1009 * diagnostic-manager.cc
1010 (diagnostic_manager::prune_for_sm_diagnostic): Replace direct
1011 access to checker_path::m_events with accessor functions. Fix
1012 overlong line.
1013 (diagnostic_manager::prune_interproc_events): Replace direct
1014 access to checker_path::m_events with accessor functions.
1015 (diagnostic_manager::finish_pruning): Likewise.
1016
94946989
DM
10172020-01-14 David Malcolm <dmalcolm@redhat.com>
1018
1019 * checker-path.h (checker_event::clone): Delete vfunc decl.
1020 (debug_event::clone): Delete vfunc impl.
1021 (custom_event::clone): Delete vfunc impl.
1022 (statement_event::clone): Delete vfunc impl.
1023 (function_entry_event::clone): Delete vfunc impl.
1024 (state_change_event::clone): Delete vfunc impl.
1025 (start_cfg_edge_event::clone): Delete vfunc impl.
1026 (end_cfg_edge_event::clone): Delete vfunc impl.
1027 (call_event::clone): Delete vfunc impl.
1028 (return_event::clone): Delete vfunc impl.
1029 (setjmp_event::clone): Delete vfunc impl.
1030 (rewind_from_longjmp_event::clone): Delete vfunc impl.
1031 (rewind_to_setjmp_event::clone): Delete vfunc impl.
1032 (warning_event::clone): Delete vfunc impl.
1033
718930c0
DM
10342020-01-14 David Malcolm <dmalcolm@redhat.com>
1035
1036 * supergraph.cc (supernode::dump_dot): Ensure that the TABLE
1037 element has at least one TR.
1038
8397af8e
DM
10392020-01-14 David Malcolm <dmalcolm@redhat.com>
1040
1041 PR analyzer/58237
1042 * engine.cc (leak_stmt_finder::find_stmt): Use get_pure_location
1043 when comparing against UNKNOWN_LOCATION.
1044 (stmt_requires_new_enode_p): Likewise.
1045 (exploded_graph::dump_exploded_nodes): Likewise.
1046 * supergraph.cc (supernode::get_start_location): Likewise.
1047 (supernode::get_end_location): Likewise.
1048
697251b7
DM
10492020-01-14 David Malcolm <dmalcolm@redhat.com>
1050
1051 PR analyzer/58237
1052 * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call
1053 selftest::analyzer_sm_file_cc_tests.
1054 * analyzer-selftests.h (selftest::analyzer_sm_file_cc_tests): New
1055 decl.
1056 * sm-file.cc: Include "analyzer/function-set.h" and
1057 "analyzer/analyzer-selftests.h".
1058 (get_file_using_fns): New function.
1059 (is_file_using_fn_p): New function.
1060 (fileptr_state_machine::on_stmt): Return true for known functions.
1061 (selftest::analyzer_sm_file_cc_tests): New function.
1062
4804c5fe
DM
10632020-01-14 David Malcolm <dmalcolm@redhat.com>
1064
1065 * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call
1066 selftest::analyzer_sm_signal_cc_tests.
1067 * analyzer-selftests.h (selftest::analyzer_sm_signal_cc_tests):
1068 New decl.
1069 * sm-signal.cc: Include "analyzer/function-set.h" and
1070 "analyzer/analyzer-selftests.h".
1071 (get_async_signal_unsafe_fns): New function.
1072 (signal_unsafe_p): Reimplement in terms of the above.
1073 (selftest::analyzer_sm_signal_cc_tests): New function.
1074
a6b5f19c
DM
10752020-01-14 David Malcolm <dmalcolm@redhat.com>
1076
1077 * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call
1078 selftest::analyzer_function_set_cc_tests.
1079 * analyzer-selftests.h (selftest::analyzer_function_set_cc_tests):
1080 New decl.
1081 * function-set.cc: New file.
1082 * function-set.h: New file.
1083
ef7827b0
DM
10842020-01-14 David Malcolm <dmalcolm@redhat.com>
1085
1086 * analyzer.h (fndecl_has_gimple_body_p): New decl.
1087 * engine.cc (impl_region_model_context::on_unknown_change): New
1088 function.
1089 (fndecl_has_gimple_body_p): Make non-static.
1090 (exploded_node::on_stmt): Treat __analyzer_dump_exploded_nodes as
1091 known. Track whether we have a call with unknown side-effects and
1092 pass it to on_call_post.
1093 * exploded-graph.h (impl_region_model_context::on_unknown_change):
1094 New decl.
1095 * program-state.cc (sm_state_map::on_unknown_change): New function.
1096 * program-state.h (sm_state_map::on_unknown_change): New decl.
1097 * region-model.cc: Include "bitmap.h".
1098 (region_model::on_call_pre): Return a bool, capturing whether the
1099 call has unknown side effects.
1100 (region_model::on_call_post): Add arg "bool unknown_side_effects"
1101 and if true, call handle_unrecognized_call.
1102 (class reachable_regions): New class.
1103 (region_model::handle_unrecognized_call): New function.
1104 * region-model.h (region_model::on_call_pre): Return a bool.
1105 (region_model::on_call_post): Add arg "bool unknown_side_effects".
1106 (region_model::handle_unrecognized_call): New decl.
1107 (region_model_context::on_unknown_change): New vfunc.
1108 (test_region_model_context::on_unknown_change): New function.
1109
14f9d7b9
DM
11102020-01-14 David Malcolm <dmalcolm@redhat.com>
1111
1112 * diagnostic-manager.cc (saved_diagnostic::operator==): Move here
1113 from header. Replace pointer equality test on m_var with call to
1114 pending_diagnostic::same_tree_p.
1115 * diagnostic-manager.h (saved_diagnostic::operator==): Move to
1116 diagnostic-manager.cc.
1117 * pending-diagnostic.cc (pending_diagnostic::same_tree_p): New.
1118 * pending-diagnostic.h (pending_diagnostic::same_tree_p): New.
1119 * sm-file.cc (file_diagnostic::subclass_equal_p): Replace pointer
1120 equality on m_arg with call to pending_diagnostic::same_tree_p.
1121 * sm-malloc.cc (malloc_diagnostic::subclass_equal_p): Likewise.
1122 (possible_null_arg::subclass_equal_p): Likewise.
1123 (null_arg::subclass_equal_p): Likewise.
1124 (free_of_non_heap::subclass_equal_p): Likewise.
1125 * sm-pattern-test.cc (pattern_match::operator==): Likewise.
1126 * sm-sensitive.cc (exposure_through_output_file::operator==):
1127 Likewise.
1128 * sm-taint.cc (tainted_array_index::operator==): Likewise.
1129
f474fbd5
DM
11302020-01-14 David Malcolm <dmalcolm@redhat.com>
1131
1132 * diagnostic-manager.cc (dedupe_winners::add): Add logging
1133 of deduplication decisions made.
1134
757bf1df
DM
11352020-01-14 David Malcolm <dmalcolm@redhat.com>
1136
1137 * ChangeLog: New file.
1138 * analyzer-selftests.cc: New file.
1139 * analyzer-selftests.h: New file.
1140 * analyzer.opt: New file.
1141 * analysis-plan.cc: New file.
1142 * analysis-plan.h: New file.
1143 * analyzer-logging.cc: New file.
1144 * analyzer-logging.h: New file.
1145 * analyzer-pass.cc: New file.
1146 * analyzer.cc: New file.
1147 * analyzer.h: New file.
1148 * call-string.cc: New file.
1149 * call-string.h: New file.
1150 * checker-path.cc: New file.
1151 * checker-path.h: New file.
1152 * constraint-manager.cc: New file.
1153 * constraint-manager.h: New file.
1154 * diagnostic-manager.cc: New file.
1155 * diagnostic-manager.h: New file.
1156 * engine.cc: New file.
1157 * engine.h: New file.
1158 * exploded-graph.h: New file.
1159 * pending-diagnostic.cc: New file.
1160 * pending-diagnostic.h: New file.
1161 * program-point.cc: New file.
1162 * program-point.h: New file.
1163 * program-state.cc: New file.
1164 * program-state.h: New file.
1165 * region-model.cc: New file.
1166 * region-model.h: New file.
1167 * sm-file.cc: New file.
1168 * sm-malloc.cc: New file.
1169 * sm-malloc.dot: New file.
1170 * sm-pattern-test.cc: New file.
1171 * sm-sensitive.cc: New file.
1172 * sm-signal.cc: New file.
1173 * sm-taint.cc: New file.
1174 * sm.cc: New file.
1175 * sm.h: New file.
1176 * state-purge.cc: New file.
1177 * state-purge.h: New file.
1178 * supergraph.cc: New file.
1179 * supergraph.h: New file.
1180
11812019-12-13 David Malcolm <dmalcolm@redhat.com>
1182
1183 * Initial creation
1184
1185\f
1186Copyright (C) 2019-2020 Free Software Foundation, Inc.
1187
1188Copying and distribution of this file, with or without modification,
1189are permitted in any medium without royalty provided the copyright
1190notice and this notice are preserved.