]>
Commit | Line | Data |
---|---|---|
0b2b45a6 DM |
1 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
2 | ||
3 | PR analyzer/93692 | |
4 | * analyzer.opt (fdump-analyzer-callgraph): Rewrite description. | |
5 | ||
4f40164a DM |
6 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
7 | ||
8 | PR analyzer/93777 | |
9 | * region-model.cc (region_model::maybe_cast_1): Replace assertion | |
10 | that build_cast returns non-NULL with a conditional, falling | |
11 | through to the logic which returns a new unknown value of the | |
12 | desired type if it fails. | |
13 | ||
2e623393 DM |
14 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
15 | ||
16 | PR analyzer/93778 | |
17 | * engine.cc (impl_region_model_context::on_unknown_tree_code): | |
18 | Rename to... | |
19 | (impl_region_model_context::on_unexpected_tree_code): ...this and | |
20 | convert first argument from path_var to tree. | |
21 | (exploded_node::on_stmt): Pass ctxt to purge_for_unknown_fncall. | |
22 | * exploded-graph.h (region_model_context::on_unknown_tree_code): | |
23 | Rename to... | |
24 | (region_model_context::on_unexpected_tree_code): ...this and | |
25 | convert first argument from path_var to tree. | |
26 | * program-state.cc (sm_state_map::purge_for_unknown_fncall): Add | |
27 | ctxt param and pass on to calls to get_rvalue. | |
28 | * program-state.h (sm_state_map::purge_for_unknown_fncall): Add | |
29 | ctxt param. | |
30 | * region-model.cc (region_model::handle_unrecognized_call): Pass | |
31 | ctxt on to call to get_rvalue. | |
32 | (region_model::get_lvalue_1): Move body of default case to | |
33 | region_model::make_region_for_unexpected_tree_code and call it. | |
34 | Within COMPONENT_REF case, reject attempts to handle types other | |
35 | than RECORD_TYPE and UNION_TYPE. | |
36 | (region_model::make_region_for_unexpected_tree_code): New | |
37 | function, based on default case of region_model::get_lvalue_1. | |
38 | * region-model.h | |
39 | (region_model::make_region_for_unexpected_tree_code): New decl. | |
40 | (region_model::on_unknown_tree_code): Rename to... | |
41 | (region_model::on_unexpected_tree_code): ...this and convert first | |
42 | argument from path_var to tree. | |
43 | (class test_region_model_context): Update vfunc implementation for | |
44 | above change. | |
45 | ||
a674c7b8 DM |
46 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
47 | ||
48 | PR analyzer/93774 | |
49 | * region-model.cc | |
50 | (region_model::convert_byte_offset_to_array_index): Use | |
51 | int_size_in_bytes before calling size_in_bytes, to gracefully fail | |
52 | on incomplete types. | |
53 | ||
d8cde6f9 DM |
54 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
55 | ||
56 | PR analyzer/93775 | |
57 | * region-model.cc (region_model::get_fndecl_for_call): Handle the | |
58 | case where the code_region's get_tree_for_child_region returns | |
59 | NULL. | |
60 | ||
f76a88eb DM |
61 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
62 | ||
63 | PR analyzer/93388 | |
64 | * engine.cc (impl_region_model_context::on_unknown_tree_code): | |
65 | New. | |
66 | (exploded_graph::get_or_create_node): Reject invalid states. | |
67 | * exploded-graph.h | |
68 | (impl_region_model_context::on_unknown_tree_code): New decl. | |
69 | (point_and_state::point_and_state): Assert that the state is | |
70 | valid. | |
71 | * program-state.cc (program_state::program_state): Initialize | |
72 | m_valid to true. | |
73 | (program_state::operator=): Copy m_valid. | |
74 | (program_state::program_state): Likewise for move constructor. | |
75 | (program_state::print): Print m_valid. | |
76 | (program_state::dump_to_pp): Likewise. | |
77 | * program-state.h (program_state::m_valid): New field. | |
78 | * region-model.cc (region_model::get_lvalue_1): Implement the | |
79 | default case by returning a new symbolic region and calling | |
80 | the context's on_unknown_tree_code, rather than issuing an | |
81 | internal_error. Implement VIEW_CONVERT_EXPR. | |
82 | * region-model.h (region_model_context::on_unknown_tree_code): New | |
83 | vfunc. | |
84 | (test_region_model_context::on_unknown_tree_code): New. | |
85 | ||
0993ad65 DM |
86 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
87 | ||
88 | * sm-malloc.cc (malloc_diagnostic::describe_state_change): For | |
89 | transition to the "null" state, only say "assuming" when | |
90 | transitioning from the "unchecked" state. | |
91 | ||
67098787 DM |
92 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
93 | ||
94 | * diagnostic-manager.h (diagnostic_manager::get_saved_diagnostic): | |
95 | Add const overload. | |
96 | * engine.cc (exploded_node::dump_dot): Dump saved_diagnostics. | |
97 | * exploded-graph.h (exploded_graph::get_diagnostic_manager): Add | |
98 | const overload. | |
99 | ||
91f993b7 DM |
100 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
101 | ||
102 | PR analyzer/93288 | |
103 | * analysis-plan.cc (analysis_plan::use_summary_p): Look through | |
104 | the ultimate_alias_target when getting the called function. | |
105 | * engine.cc (exploded_node::on_stmt): Rename second "ctxt" to | |
106 | "sm_ctxt". Use the region_model's get_fndecl_for_call rather than | |
107 | gimple_call_fndecl. | |
108 | * region-model.cc (region_model::get_fndecl_for_call): Use | |
109 | ultimate_alias_target on fndecl. | |
110 | * supergraph.cc (get_ultimate_function_for_cgraph_edge): New | |
111 | function. | |
112 | (supergraph_call_edge): Use it when rejecting edges without | |
113 | functions. | |
114 | (supergraph::supergraph): Use it to get the function for the | |
115 | cgraph_edge when building interprocedural superedges. | |
116 | (callgraph_superedge::get_callee_function): Use it. | |
117 | * supergraph.h (supergraph::get_num_snodes): Make param const. | |
118 | (supergraph::function_to_num_snodes_t): Make first type param | |
119 | const. | |
120 | ||
a60d9889 DM |
121 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
122 | ||
123 | PR analyzer/93374 | |
124 | * engine.cc (exploded_edge::exploded_edge): Add ext_state param | |
125 | and pass it to change.validate. | |
126 | (exploded_graph::get_or_create_node): Move purging of change | |
127 | svalues to also cover the case of reusing an existing enode. | |
128 | (exploded_graph::add_edge): Pass m_ext_state to exploded_edge's | |
129 | ctor. | |
130 | * exploded-graph.h (exploded_edge::exploded_edge): Add ext_state | |
131 | param. | |
132 | * program-state.cc (state_change::sm_change::validate): Likewise. | |
133 | Assert that m_sm_idx is sane. Use ext_state to validate | |
134 | m_old_state and m_new_state. | |
135 | (state_change::validate): Add ext_state param and pass it to | |
136 | the sm_change validate calls. | |
137 | * program-state.h (state_change::sm_change::validate): Add | |
138 | ext_state param. | |
139 | (state_change::validate): Likewise. | |
140 | ||
a0e4929b DM |
141 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
142 | ||
143 | PR analyzer/93669 | |
144 | * engine.cc (exploded_graph::dump_exploded_nodes): Handle missing | |
145 | case of STATUS_WORKLIST in implementation of | |
146 | "__analyzer_dump_exploded_nodes". | |
147 | ||
cd28b759 DM |
148 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
149 | ||
150 | PR analyzer/93649 | |
151 | * constraint-manager.cc (constraint_manager::add_constraint): When | |
152 | merging equivalence classes and updating m_constant, also update | |
153 | m_cst_sid. | |
154 | (constraint_manager::validate): If m_constant is non-NULL assert | |
155 | that m_cst_sid is non-null and is valid. | |
156 | ||
5e17c1bd DM |
157 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
158 | ||
159 | PR analyzer/93657 | |
160 | * analyzer.opt (fdump-analyzer): Reword description. | |
161 | (fdump-analyzer-stderr): Likewise. | |
162 | ||
c46d057f DM |
163 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
164 | ||
165 | * region-model.cc (print_quoted_type): New function. | |
166 | (svalue::print): Use it to replace %qT. | |
167 | (region::dump_to_pp): Likewise. | |
168 | (region::dump_child_label): Likewise. | |
169 | (region::print_fields): Likewise. | |
170 | ||
eb031d4b DM |
171 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
172 | ||
173 | PR analyzer/93659 | |
174 | * analyzer.opt (-param=analyzer-max-recursion-depth=): Fix "tha" | |
175 | -> "that" typo. | |
176 | (Wanalyzer-use-of-uninitialized-value): Fix "initialized" -> | |
177 | "uninitialized" typo. | |
178 | ||
e87deb37 DM |
179 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
180 | ||
181 | PR analyzer/93350 | |
182 | * region-model.cc (region_model::get_lvalue_1): | |
183 | Handle BIT_FIELD_REF. | |
184 | (make_region_for_type): Handle VECTOR_TYPE. | |
185 | ||
e953f958 DM |
186 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
187 | ||
188 | PR analyzer/93647 | |
189 | * diagnostic-manager.cc | |
190 | (diagnostic_manager::prune_for_sm_diagnostic): Bulletproof against | |
191 | VAR being constant. | |
192 | * region-model.cc (region_model::get_lvalue_1): Provide a better | |
193 | error message when encountering an unhandled tree code. | |
194 | ||
41a9e940 DM |
195 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
196 | ||
197 | PR analyzer/93405 | |
198 | * region-model.cc (region_model::get_lvalue_1): Implement | |
199 | CONST_DECL. | |
200 | ||
cb273d81 DM |
201 | 2020-02-06 David Malcolm <dmalcolm@redhat.com> |
202 | ||
203 | * region-model.cc (region_model::maybe_cast_1): Attempt to provide | |
204 | a region_svalue if either type is a pointer, rather than if both | |
205 | types are pointers. | |
206 | ||
a4d3bfc0 DM |
207 | 2020-02-05 David Malcolm <dmalcolm@redhat.com> |
208 | ||
209 | * engine.cc (exploded_node::dump_dot): Show merger enodes. | |
210 | (worklist::add_node): Assert that the node's m_status is | |
211 | STATUS_WORKLIST. | |
212 | (exploded_graph::process_worklist): Likewise for nodes from the | |
213 | worklist. Set status of merged nodes to STATUS_MERGER. | |
214 | (exploded_graph::process_node): Set status of node to | |
215 | STATUS_PROCESSED. | |
216 | (exploded_graph::dump_exploded_nodes): Rework handling of | |
217 | "__analyzer_dump_exploded_nodes", splitting enodes by status into | |
218 | "processed" and "merger", showing the count of just the processed | |
219 | enodes at the call, rather than the count of all enodes. | |
220 | * exploded-graph.h (exploded_node::status): New enum. | |
221 | (exploded_node::exploded_node): Initialize m_status to | |
222 | STATUS_WORKLIST. | |
223 | (exploded_node::get_status): New getter. | |
224 | (exploded_node::set_status): New setter. | |
225 | ||
1dae549d DM |
226 | 2020-02-04 David Malcolm <dmalcolm@redhat.com> |
227 | ||
228 | PR analyzer/93543 | |
229 | * engine.cc (pod_hash_traits<function_call_string>::mark_empty): | |
230 | Eliminate reinterpret_cast. | |
231 | (pod_hash_traits<function_call_string>::is_empty): Likewise. | |
232 | ||
833f1e66 DM |
233 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
234 | ||
235 | * constraint-manager.cc (range::constrained_to_single_element): | |
236 | Replace fold_build2 with fold_binary. Remove unnecessary newline. | |
237 | (constraint_manager::get_or_add_equiv_class): Replace fold_build2 | |
238 | with fold_binary in two places, and remove out-of-date comment. | |
239 | (constraint_manager::eval_condition): Replace fold_build2 with | |
240 | fold_binary. | |
241 | * region-model.cc (constant_svalue::eval_condition): Likewise. | |
242 | (region_model::on_assignment): Likewise. | |
243 | ||
8525d1f5 DM |
244 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
245 | ||
246 | PR analyzer/93544 | |
247 | * diagnostic-manager.cc | |
248 | (diagnostic_manager::prune_for_sm_diagnostic): Bulletproof | |
249 | against bad choices due to bad paths. | |
250 | * engine.cc (impl_region_model_context::on_phi): New. | |
251 | * exploded-graph.h (impl_region_model_context::on_phi): New decl. | |
252 | * region-model.cc (region_model::on_longjmp): Likewise. | |
253 | (region_model::handle_phi): Add phi param. Call the ctxt's on_phi | |
254 | vfunc. | |
255 | (region_model::update_for_phis): Pass phi to handle_phi. | |
256 | * region-model.h (region_model::handle_phi): Add phi param. | |
257 | (region_model_context::on_phi): New vfunc. | |
258 | (test_region_model_context::on_phi): New. | |
259 | * sm-malloc.cc (malloc_state_machine::on_phi): New. | |
260 | (malloc_state_machine::on_zero_assignment): New. | |
261 | * sm.h (state_machine::on_phi): New vfunc. | |
262 | ||
73f38658 DM |
263 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
264 | ||
265 | * engine.cc (supernode_cluster::dump_dot): Show BB index as | |
266 | well as SN index. | |
267 | * supergraph.cc (supernode::dump_dot): Likewise. | |
268 | ||
5e10b9a2 DM |
269 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
270 | ||
271 | PR analyzer/93546 | |
272 | * region-model.cc (region_model::on_call_pre): Update for new | |
273 | param of symbolic_region ctor. | |
274 | (region_model::deref_rvalue): Likewise. | |
275 | (region_model::add_new_malloc_region): Likewise. | |
276 | (make_region_for_type): Likewise, preserving type. | |
277 | * region-model.h (symbolic_region::symbolic_region): Add "type" | |
278 | param and pass it to base class ctor. | |
279 | ||
287ccd3b DM |
280 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
281 | ||
282 | PR analyzer/93547 | |
283 | * constraint-manager.cc | |
284 | (constraint_manager::get_or_add_equiv_class): Ensure types are | |
285 | compatible before comparing constants. | |
286 | ||
67751724 DM |
287 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
288 | ||
289 | PR analyzer/93457 | |
290 | * region-model.cc (make_region_for_type): Use VOID_TYPE_P rather | |
291 | than checking against void_type_node. | |
292 | ||
09bea584 DM |
293 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
294 | ||
295 | PR analyzer/93373 | |
296 | * region-model.cc (ASSERT_COMPAT_TYPES): Convert to... | |
297 | (assert_compat_types): ...this, and bail when either type is NULL, | |
298 | or when VOID_TYPE_P (dst_type). | |
299 | (region_model::get_lvalue): Update for above conversion. | |
300 | (region_model::get_rvalue): Likewise. | |
301 | ||
f1c807e8 DM |
302 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
303 | ||
304 | PR analyzer/93379 | |
305 | * region-model.cc (region_model::update_for_return_superedge): | |
306 | Move check for null result so that it also guards setting the | |
307 | lhs. | |
308 | ||
455f58ec DM |
309 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
310 | ||
311 | PR analyzer/93438 | |
312 | * region-model.cc (stack_region::can_merge_p): Split into a two | |
313 | pass approach, creating all stack regions first, then populating | |
314 | them. | |
315 | (selftest::test_state_merging): Add test coverage for (a) the case | |
316 | of self-merging a model in which a local in an older stack frame | |
317 | points to a local in a more recent stack frame (which previously | |
318 | would ICE), and (b) the case of self-merging a model in which a | |
319 | local points to a global (which previously worked OK). | |
320 | ||
182ce042 DM |
321 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
322 | ||
323 | * analyzer.cc (is_named_call_p): Replace tests for fndecl being | |
324 | extern at file scope and having a non-NULL DECL_NAME with a call | |
325 | to maybe_special_function_p. | |
326 | * function-set.cc (function_set::contains_decl_p): Add call to | |
327 | maybe_special_function_p. | |
328 | ||
45eb3e49 DM |
329 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
330 | ||
331 | PR analyzer/93450 | |
332 | * constraint-manager.cc | |
333 | (constraint_manager::get_or_add_equiv_class): Only compare constants | |
334 | if their types are compatible. | |
335 | * region-model.cc (constant_svalue::eval_condition): Replace check | |
336 | for identical types with call to types_compatible_p. | |
337 | ||
42f36563 DM |
338 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
339 | ||
340 | * program-state.cc (extrinsic_state::dump_to_pp): New. | |
341 | (extrinsic_state::dump_to_file): New. | |
342 | (extrinsic_state::dump): New. | |
343 | * program-state.h (extrinsic_state::dump_to_pp): New decl. | |
344 | (extrinsic_state::dump_to_file): New decl. | |
345 | (extrinsic_state::dump): New decl. | |
346 | * sm.cc: Include "pretty-print.h". | |
347 | (state_machine::dump_to_pp): New. | |
348 | * sm.h (state_machine::dump_to_pp): New decl. | |
349 | ||
ebe9174e DM |
350 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
351 | ||
352 | * diagnostic-manager.cc (for_each_state_change): Use | |
353 | extrinsic_state::get_num_checkers rather than accessing m_checkers | |
354 | directly. | |
355 | * program-state.cc (program_state::program_state): Likewise. | |
356 | * program-state.h (extrinsic_state::m_checkers): Make private. | |
357 | ||
e978955d DM |
358 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
359 | ||
360 | PR analyzer/93356 | |
361 | * region-model.cc (region_model::eval_condition): In both | |
362 | overloads, bail out immediately on floating-point types. | |
363 | (region_model::eval_condition_without_cm): Likewise. | |
364 | (region_model::add_constraint): Likewise. | |
365 | ||
d177c49c DM |
366 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
367 | ||
368 | PR analyzer/93450 | |
369 | * program-state.cc (sm_state_map::set_state): For the overload | |
370 | taking an svalue_id, bail out if the set_state on the ec does | |
371 | nothing. Convert the latter's return type from void to bool, | |
372 | returning true if anything changed. | |
373 | (sm_state_map::impl_set_state): Convert the return type from void | |
374 | to bool, returning true if the state changed. | |
375 | * program-state.h (sm_state_map::set_state): Convert return type | |
376 | from void to bool. | |
377 | (sm_state_map::impl_set_state): Likewise. | |
378 | * region-model.cc (constant_svalue::eval_condition): Only call | |
379 | fold_build2 if the types are the same. | |
380 | ||
7892ff37 JJ |
381 | 2020-01-29 Jakub Jelinek <jakub@redhat.com> |
382 | ||
383 | * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Remove. | |
384 | * constraint-manager.cc: Include diagnostic-core.h before graphviz.h. | |
385 | (range::dump, equiv_class::print): Don't use PUSH_IGNORE_WFORMAT or | |
386 | POP_IGNORE_WFORMAT. | |
387 | * state-purge.cc: Include diagnostic-core.h before | |
388 | gimple-pretty-print.h. | |
389 | (state_purge_annotator::add_node_annotations, print_vec_of_names): | |
390 | Don't use PUSH_IGNORE_WFORMAT or POP_IGNORE_WFORMAT. | |
391 | * region-model.cc: Move diagnostic-core.h include before graphviz.h. | |
392 | (path_var::dump, svalue::print, constant_svalue::print_details, | |
393 | region::dump_to_pp, region::dump_child_label, region::print_fields, | |
394 | map_region::print_fields, map_region::dump_dot_to_pp, | |
395 | map_region::dump_child_label, array_region::print_fields, | |
396 | array_region::dump_dot_to_pp): Don't use PUSH_IGNORE_WFORMAT or | |
397 | POP_IGNORE_WFORMAT. | |
398 | ||
5aebfb71 DM |
399 | 2020-01-28 David Malcolm <dmalcolm@redhat.com> |
400 | ||
401 | PR analyzer/93316 | |
402 | * engine.cc (rewind_info_t::update_model): Get the longjmp call | |
403 | stmt via get_longjmp_call () rather than assuming it is the last | |
404 | stmt in the longjmp's supernode. | |
405 | (rewind_info_t::add_events_to_path): Get the location_t for the | |
406 | rewind_from_longjmp_event via get_longjmp_call () rather than from | |
407 | the supernode's get_end_location (). | |
408 | ||
6c8e5844 DM |
409 | 2020-01-28 David Malcolm <dmalcolm@redhat.com> |
410 | ||
411 | * region-model.cc (poisoned_value_diagnostic::emit): Update for | |
412 | renaming of warning_at overload to warning_meta. | |
413 | * sm-file.cc (file_leak::emit): Likewise. | |
414 | * sm-malloc.cc (double_free::emit): Likewise. | |
415 | (possible_null_deref::emit): Likewise. | |
416 | (possible_null_arg::emit): Likewise. | |
417 | (null_deref::emit): Likewise. | |
418 | (null_arg::emit): Likewise. | |
419 | (use_after_free::emit): Likewise. | |
420 | (malloc_leak::emit): Likewise. | |
421 | (free_of_non_heap::emit): Likewise. | |
422 | * sm-sensitive.cc (exposure_through_output_file::emit): Likewise. | |
423 | * sm-signal.cc (signal_unsafe_call::emit): Likewise. | |
424 | * sm-taint.cc (tainted_array_index::emit): Likewise. | |
425 | ||
8c08c983 DM |
426 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
427 | ||
428 | PR analyzer/93451 | |
429 | * region-model.cc (tree_cmp): For the REAL_CST case, impose an | |
430 | arbitrary order on NaNs relative to other NaNs and to non-NaNs; | |
431 | const-correctness tweak. | |
432 | (ana::selftests::build_real_cst_from_string): New function. | |
433 | (ana::selftests::append_interesting_constants): New function. | |
434 | (ana::selftests::test_tree_cmp_on_constants): New test. | |
435 | (ana::selftests::test_canonicalization_4): New test. | |
436 | (ana::selftests::analyzer_region_model_cc_tests): Call the new | |
437 | tests. | |
438 | ||
2fbea419 DM |
439 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
440 | ||
441 | PR analyzer/93349 | |
442 | * engine.cc (run_checkers): Save and restore input_location. | |
443 | ||
6a81cabc DM |
444 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
445 | ||
446 | * call-string.cc (call_string::cmp_1): Delete, moving body to... | |
447 | (call_string::cmp): ...here. | |
448 | * call-string.h (call_string::cmp_1): Delete decl. | |
449 | * engine.cc (worklist::key_t::cmp_1): Delete, moving body to... | |
450 | (worklist::key_t::cmp): ...here. Implement hash comparisons | |
451 | via comparison rather than subtraction to avoid overflow issues. | |
452 | * exploded-graph.h (worklist::key_t::cmp_1): Delete decl. | |
453 | * region-model.cc (tree_cmp): Eliminate buggy checking for | |
454 | symmetry. | |
455 | ||
342e14ff DM |
456 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
457 | ||
458 | * analyzer.cc (is_named_call_p): Check that fndecl is "extern" | |
459 | and at file scope. Potentially disregard prefix _ or __ in | |
460 | fndecl's name. Bail if the identifier is NULL. | |
461 | (is_setjmp_call_p): Expect a gcall rather than plain gimple. | |
462 | Remove special-case check for leading prefix, and also check for | |
463 | sigsetjmp. | |
464 | (is_longjmp_call_p): Also check for siglongjmp. | |
465 | (get_user_facing_name): New function. | |
466 | * analyzer.h (is_setjmp_call_p): Expect a gcall rather than plain | |
467 | gimple. | |
468 | (get_user_facing_name): New decl. | |
469 | * checker-path.cc (setjmp_event::get_desc): Use | |
470 | get_user_facing_name to avoid hardcoding the function name. | |
471 | (rewind_event::rewind_event): Add rewind_info param, using it to | |
472 | initialize new m_rewind_info field, and strengthen the assertion. | |
473 | (rewind_from_longjmp_event::get_desc): Use get_user_facing_name to | |
474 | avoid hardcoding the function name. | |
475 | (rewind_to_setjmp_event::get_desc): Likewise. | |
476 | * checker-path.h (setjmp_event::setjmp_event): Add setjmp_call | |
477 | param and use it to initialize... | |
478 | (setjmp_event::m_setjmp_call): New field. | |
479 | (rewind_event::rewind_event): Add rewind_info param. | |
480 | (rewind_event::m_rewind_info): New protected field. | |
481 | (rewind_from_longjmp_event::rewind_from_longjmp_event): Add | |
482 | rewind_info param. | |
483 | (class rewind_to_setjmp_event): Move rewind_info field to parent | |
484 | class. | |
485 | * diagnostic-manager.cc (diagnostic_manager::add_events_for_eedge): | |
486 | Update setjmp-handling for is_setjmp_call_p requiring a gcall; | |
487 | pass the call to the new setjmp_event. | |
488 | * engine.cc (exploded_node::on_stmt): Update for is_setjmp_call_p | |
489 | requiring a gcall. | |
490 | (stale_jmp_buf::emit): Use get_user_facing_name to avoid | |
491 | hardcoding the function names. | |
492 | (exploded_node::on_longjmp): Pass the longjmp_call when | |
493 | constructing rewind_info. | |
494 | (rewind_info_t::add_events_to_path): Pass the rewind_info_t to the | |
495 | rewind_from_longjmp_event's ctor. | |
496 | * exploded-graph.h (rewind_info_t::rewind_info_t): Add | |
497 | longjmp_call param. | |
498 | (rewind_info_t::get_longjmp_call): New. | |
499 | (rewind_info_t::m_longjmp_call): New. | |
500 | * region-model.cc (region_model::on_setjmp): Update comment to | |
501 | indicate this is also for sigsetjmp. | |
502 | * region-model.h (struct setjmp_record): Likewise. | |
503 | (class setjmp_svalue): Likewise. | |
504 | ||
26d949c8 DM |
505 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
506 | ||
507 | PR analyzer/93276 | |
508 | * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Guard these | |
509 | macros with GCC_VERSION >= 4006, making them no-op otherwise. | |
510 | * engine.cc (exploded_edge::exploded_edge): Specify template for | |
511 | base class initializer. | |
512 | (exploded_graph::add_edge): Specify template when chaining up to | |
513 | base class add_edge implementation. | |
514 | (viz_callgraph_node::dump_dot): Drop redundant "typename". | |
515 | (viz_callgraph_edge::viz_callgraph_edge): Specify template for | |
516 | base class initializer. | |
517 | * program-state.cc (sm_state_map::clone_with_remapping): Drop | |
518 | redundant "typename". | |
519 | (sm_state_map::print): Likewise. | |
520 | (sm_state_map::hash): Likewise. | |
521 | (sm_state_map::operator==): Likewise. | |
522 | (sm_state_map::remap_svalue_ids): Likewise. | |
523 | (sm_state_map::on_svalue_purge): Likewise. | |
524 | (sm_state_map::validate): Likewise. | |
525 | * program-state.h (sm_state_map::iterator_t): Likewise. | |
526 | * supergraph.h (superedge::superedge): Specify template for base | |
527 | class initializer. | |
528 | ||
648796da DM |
529 | 2020-01-23 David Malcolm <dmalcolm@redhat.com> |
530 | ||
531 | PR analyzer/93375 | |
532 | * supergraph.cc (callgraph_superedge::get_arg_for_parm): Fail | |
533 | gracefully is the number of parameters at the callee exceeds the | |
534 | number of arguments at the call stmt. | |
535 | (callgraph_superedge::get_parm_for_arg): Likewise. | |
536 | ||
591b59eb DM |
537 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
538 | ||
539 | PR analyzer/93382 | |
540 | * program-state.cc (sm_state_map::on_svalue_purge): If the | |
541 | entry survives, but the origin is being purged, then reset the | |
542 | origin to null. | |
543 | ||
c9c8aef4 DM |
544 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
545 | ||
546 | * sm-signal.cc: Fix nesting of CHECKING_P and namespace ana. | |
547 | ||
fd9982bb DM |
548 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
549 | ||
550 | PR analyzer/93378 | |
551 | * engine.cc (setjmp_svalue::compare_fields): Update for | |
552 | replacement of m_enode with m_setjmp_record. | |
553 | (setjmp_svalue::add_to_hash): Likewise. | |
554 | (setjmp_svalue::get_index): Rename... | |
555 | (setjmp_svalue::get_enode_index): ...to this. | |
556 | (setjmp_svalue::print_details): Update for replacement of m_enode | |
557 | with m_setjmp_record. | |
558 | (exploded_node::on_longjmp): Likewise. | |
559 | * exploded-graph.h (rewind_info_t::m_enode_origin): Replace... | |
560 | (rewind_info_t::m_setjmp_record): ...with this. | |
561 | (rewind_info_t::rewind_info_t): Update for replacement of m_enode | |
562 | with m_setjmp_record. | |
563 | (rewind_info_t::get_setjmp_point): Likewise. | |
564 | (rewind_info_t::get_setjmp_call): Likewise. | |
565 | * region-model.cc (region_model::dump_summary_of_map): Likewise. | |
566 | (region_model::on_setjmp): Likewise. | |
567 | * region-model.h (struct setjmp_record): New struct. | |
568 | (setjmp_svalue::m_enode): Replace... | |
569 | (setjmp_svalue::m_setjmp_record): ...with this. | |
570 | (setjmp_svalue::setjmp_svalue): Update for replacement of m_enode | |
571 | with m_setjmp_record. | |
572 | (setjmp_svalue::clone): Likewise. | |
573 | (setjmp_svalue::get_index): Rename... | |
574 | (setjmp_svalue::get_enode_index): ...to this. | |
575 | (setjmp_svalue::get_exploded_node): Replace... | |
576 | (setjmp_svalue::get_setjmp_record): ...with this. | |
577 | ||
da7cf663 DM |
578 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
579 | ||
580 | PR analyzer/93316 | |
581 | * analyzer.cc (is_setjmp_call_p): Check for "setjmp" as well as | |
582 | "_setjmp". | |
583 | ||
75038aa6 DM |
584 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
585 | ||
586 | PR analyzer/93307 | |
587 | * analysis-plan.h: Wrap everything namespace "ana". | |
588 | * analyzer-logging.cc: Likewise. | |
589 | * analyzer-logging.h: Likewise. | |
590 | * analyzer-pass.cc (pass_analyzer::execute): Update for "ana" | |
591 | namespace. | |
592 | * analyzer-selftests.cc: Wrap everything namespace "ana". | |
593 | * analyzer-selftests.h: Likewise. | |
594 | * analyzer.h: Likewise for forward decls of types. | |
595 | * call-string.h: Likewise. | |
596 | * checker-path.cc: Likewise. | |
597 | * checker-path.h: Likewise. | |
598 | * constraint-manager.cc: Likewise. | |
599 | * constraint-manager.h: Likewise. | |
600 | * diagnostic-manager.cc: Likewise. | |
601 | * diagnostic-manager.h: Likewise. | |
602 | * engine.cc: Likewise. | |
603 | * engine.h: Likewise. | |
604 | * exploded-graph.h: Likewise. | |
605 | * function-set.cc: Likewise. | |
606 | * function-set.h: Likewise. | |
607 | * pending-diagnostic.cc: Likewise. | |
608 | * pending-diagnostic.h: Likewise. | |
609 | * program-point.cc: Likewise. | |
610 | * program-point.h: Likewise. | |
611 | * program-state.cc: Likewise. | |
612 | * program-state.h: Likewise. | |
613 | * region-model.cc: Likewise. | |
614 | * region-model.h: Likewise. | |
615 | * sm-file.cc: Likewise. | |
616 | * sm-malloc.cc: Likewise. | |
617 | * sm-pattern-test.cc: Likewise. | |
618 | * sm-sensitive.cc: Likewise. | |
619 | * sm-signal.cc: Likewise. | |
620 | * sm-taint.cc: Likewise. | |
621 | * sm.cc: Likewise. | |
622 | * sm.h: Likewise. | |
623 | * state-purge.h: Likewise. | |
624 | * supergraph.cc: Likewise. | |
625 | * supergraph.h: Likewise. | |
626 | ||
4f01e577 DM |
627 | 2020-01-21 David Malcolm <dmalcolm@redhat.com> |
628 | ||
629 | PR analyzer/93352 | |
630 | * region-model.cc (int_cmp): Rename to... | |
631 | (array_region::key_cmp): ...this, using key_t rather than int. | |
632 | Rewrite in terms of comparisons rather than subtraction to | |
633 | ensure qsort is anti-symmetric when handling extreme values. | |
634 | (array_region::walk_for_canonicalization): Update for above | |
635 | renaming. | |
636 | * region-model.h (array_region::key_cmp): New decl. | |
637 | ||
07c86323 DM |
638 | 2020-01-17 David Malcolm <dmalcolm@redhat.com> |
639 | ||
640 | PR analyzer/93290 | |
641 | * region-model.cc (region_model::eval_condition_without_cm): Avoid | |
642 | gcc_unreachable for unexpected operations for the case where | |
643 | we're comparing an svalue against itself. | |
644 | ||
5f030383 DM |
645 | 2020-01-17 David Malcolm <dmalcolm@redhat.com> |
646 | ||
647 | PR analyzer/93281 | |
648 | * region-model.cc | |
649 | (region_model::convert_byte_offset_to_array_index): Convert to | |
650 | ssizetype before dividing by byte_size. Use fold_binary rather | |
651 | than fold_build2 to avoid needlessly constructing a tree for the | |
652 | non-const case. | |
653 | ||
49e9a999 DM |
654 | 2020-01-15 David Malcolm <dmalcolm@redhat.com> |
655 | ||
656 | * engine.cc (class impl_region_model_context): Fix comment. | |
657 | ||
32077b69 DM |
658 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
659 | ||
660 | PR analyzer/93212 | |
661 | * region-model.cc (make_region_for_type): Use | |
662 | FUNC_OR_METHOD_TYPE_P rather than comparing against FUNCTION_TYPE. | |
663 | * region-model.h (function_region::function_region): Likewise. | |
664 | ||
7fb3669e DM |
665 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
666 | ||
667 | * program-state.cc (sm_state_map::clone_with_remapping): Copy | |
668 | m_global_state. | |
669 | (selftest::test_program_state_merging_2): New selftest. | |
670 | (selftest::analyzer_program_state_cc_tests): Call it. | |
671 | ||
e2a538b1 DM |
672 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
673 | ||
674 | * checker-path.h (checker_path::get_checker_event): New function. | |
675 | (checker_path): Add DISABLE_COPY_AND_ASSIGN; make fields private. | |
676 | * diagnostic-manager.cc | |
677 | (diagnostic_manager::prune_for_sm_diagnostic): Replace direct | |
678 | access to checker_path::m_events with accessor functions. Fix | |
679 | overlong line. | |
680 | (diagnostic_manager::prune_interproc_events): Replace direct | |
681 | access to checker_path::m_events with accessor functions. | |
682 | (diagnostic_manager::finish_pruning): Likewise. | |
683 | ||
94946989 DM |
684 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
685 | ||
686 | * checker-path.h (checker_event::clone): Delete vfunc decl. | |
687 | (debug_event::clone): Delete vfunc impl. | |
688 | (custom_event::clone): Delete vfunc impl. | |
689 | (statement_event::clone): Delete vfunc impl. | |
690 | (function_entry_event::clone): Delete vfunc impl. | |
691 | (state_change_event::clone): Delete vfunc impl. | |
692 | (start_cfg_edge_event::clone): Delete vfunc impl. | |
693 | (end_cfg_edge_event::clone): Delete vfunc impl. | |
694 | (call_event::clone): Delete vfunc impl. | |
695 | (return_event::clone): Delete vfunc impl. | |
696 | (setjmp_event::clone): Delete vfunc impl. | |
697 | (rewind_from_longjmp_event::clone): Delete vfunc impl. | |
698 | (rewind_to_setjmp_event::clone): Delete vfunc impl. | |
699 | (warning_event::clone): Delete vfunc impl. | |
700 | ||
718930c0 DM |
701 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
702 | ||
703 | * supergraph.cc (supernode::dump_dot): Ensure that the TABLE | |
704 | element has at least one TR. | |
705 | ||
8397af8e DM |
706 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
707 | ||
708 | PR analyzer/58237 | |
709 | * engine.cc (leak_stmt_finder::find_stmt): Use get_pure_location | |
710 | when comparing against UNKNOWN_LOCATION. | |
711 | (stmt_requires_new_enode_p): Likewise. | |
712 | (exploded_graph::dump_exploded_nodes): Likewise. | |
713 | * supergraph.cc (supernode::get_start_location): Likewise. | |
714 | (supernode::get_end_location): Likewise. | |
715 | ||
697251b7 DM |
716 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
717 | ||
718 | PR analyzer/58237 | |
719 | * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call | |
720 | selftest::analyzer_sm_file_cc_tests. | |
721 | * analyzer-selftests.h (selftest::analyzer_sm_file_cc_tests): New | |
722 | decl. | |
723 | * sm-file.cc: Include "analyzer/function-set.h" and | |
724 | "analyzer/analyzer-selftests.h". | |
725 | (get_file_using_fns): New function. | |
726 | (is_file_using_fn_p): New function. | |
727 | (fileptr_state_machine::on_stmt): Return true for known functions. | |
728 | (selftest::analyzer_sm_file_cc_tests): New function. | |
729 | ||
4804c5fe DM |
730 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
731 | ||
732 | * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call | |
733 | selftest::analyzer_sm_signal_cc_tests. | |
734 | * analyzer-selftests.h (selftest::analyzer_sm_signal_cc_tests): | |
735 | New decl. | |
736 | * sm-signal.cc: Include "analyzer/function-set.h" and | |
737 | "analyzer/analyzer-selftests.h". | |
738 | (get_async_signal_unsafe_fns): New function. | |
739 | (signal_unsafe_p): Reimplement in terms of the above. | |
740 | (selftest::analyzer_sm_signal_cc_tests): New function. | |
741 | ||
a6b5f19c DM |
742 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
743 | ||
744 | * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call | |
745 | selftest::analyzer_function_set_cc_tests. | |
746 | * analyzer-selftests.h (selftest::analyzer_function_set_cc_tests): | |
747 | New decl. | |
748 | * function-set.cc: New file. | |
749 | * function-set.h: New file. | |
750 | ||
ef7827b0 DM |
751 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
752 | ||
753 | * analyzer.h (fndecl_has_gimple_body_p): New decl. | |
754 | * engine.cc (impl_region_model_context::on_unknown_change): New | |
755 | function. | |
756 | (fndecl_has_gimple_body_p): Make non-static. | |
757 | (exploded_node::on_stmt): Treat __analyzer_dump_exploded_nodes as | |
758 | known. Track whether we have a call with unknown side-effects and | |
759 | pass it to on_call_post. | |
760 | * exploded-graph.h (impl_region_model_context::on_unknown_change): | |
761 | New decl. | |
762 | * program-state.cc (sm_state_map::on_unknown_change): New function. | |
763 | * program-state.h (sm_state_map::on_unknown_change): New decl. | |
764 | * region-model.cc: Include "bitmap.h". | |
765 | (region_model::on_call_pre): Return a bool, capturing whether the | |
766 | call has unknown side effects. | |
767 | (region_model::on_call_post): Add arg "bool unknown_side_effects" | |
768 | and if true, call handle_unrecognized_call. | |
769 | (class reachable_regions): New class. | |
770 | (region_model::handle_unrecognized_call): New function. | |
771 | * region-model.h (region_model::on_call_pre): Return a bool. | |
772 | (region_model::on_call_post): Add arg "bool unknown_side_effects". | |
773 | (region_model::handle_unrecognized_call): New decl. | |
774 | (region_model_context::on_unknown_change): New vfunc. | |
775 | (test_region_model_context::on_unknown_change): New function. | |
776 | ||
14f9d7b9 DM |
777 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
778 | ||
779 | * diagnostic-manager.cc (saved_diagnostic::operator==): Move here | |
780 | from header. Replace pointer equality test on m_var with call to | |
781 | pending_diagnostic::same_tree_p. | |
782 | * diagnostic-manager.h (saved_diagnostic::operator==): Move to | |
783 | diagnostic-manager.cc. | |
784 | * pending-diagnostic.cc (pending_diagnostic::same_tree_p): New. | |
785 | * pending-diagnostic.h (pending_diagnostic::same_tree_p): New. | |
786 | * sm-file.cc (file_diagnostic::subclass_equal_p): Replace pointer | |
787 | equality on m_arg with call to pending_diagnostic::same_tree_p. | |
788 | * sm-malloc.cc (malloc_diagnostic::subclass_equal_p): Likewise. | |
789 | (possible_null_arg::subclass_equal_p): Likewise. | |
790 | (null_arg::subclass_equal_p): Likewise. | |
791 | (free_of_non_heap::subclass_equal_p): Likewise. | |
792 | * sm-pattern-test.cc (pattern_match::operator==): Likewise. | |
793 | * sm-sensitive.cc (exposure_through_output_file::operator==): | |
794 | Likewise. | |
795 | * sm-taint.cc (tainted_array_index::operator==): Likewise. | |
796 | ||
f474fbd5 DM |
797 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
798 | ||
799 | * diagnostic-manager.cc (dedupe_winners::add): Add logging | |
800 | of deduplication decisions made. | |
801 | ||
757bf1df DM |
802 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
803 | ||
804 | * ChangeLog: New file. | |
805 | * analyzer-selftests.cc: New file. | |
806 | * analyzer-selftests.h: New file. | |
807 | * analyzer.opt: New file. | |
808 | * analysis-plan.cc: New file. | |
809 | * analysis-plan.h: New file. | |
810 | * analyzer-logging.cc: New file. | |
811 | * analyzer-logging.h: New file. | |
812 | * analyzer-pass.cc: New file. | |
813 | * analyzer.cc: New file. | |
814 | * analyzer.h: New file. | |
815 | * call-string.cc: New file. | |
816 | * call-string.h: New file. | |
817 | * checker-path.cc: New file. | |
818 | * checker-path.h: New file. | |
819 | * constraint-manager.cc: New file. | |
820 | * constraint-manager.h: New file. | |
821 | * diagnostic-manager.cc: New file. | |
822 | * diagnostic-manager.h: New file. | |
823 | * engine.cc: New file. | |
824 | * engine.h: New file. | |
825 | * exploded-graph.h: New file. | |
826 | * pending-diagnostic.cc: New file. | |
827 | * pending-diagnostic.h: New file. | |
828 | * program-point.cc: New file. | |
829 | * program-point.h: New file. | |
830 | * program-state.cc: New file. | |
831 | * program-state.h: New file. | |
832 | * region-model.cc: New file. | |
833 | * region-model.h: New file. | |
834 | * sm-file.cc: New file. | |
835 | * sm-malloc.cc: New file. | |
836 | * sm-malloc.dot: New file. | |
837 | * sm-pattern-test.cc: New file. | |
838 | * sm-sensitive.cc: New file. | |
839 | * sm-signal.cc: New file. | |
840 | * sm-taint.cc: New file. | |
841 | * sm.cc: New file. | |
842 | * sm.h: New file. | |
843 | * state-purge.cc: New file. | |
844 | * state-purge.h: New file. | |
845 | * supergraph.cc: New file. | |
846 | * supergraph.h: New file. | |
847 | ||
848 | 2019-12-13 David Malcolm <dmalcolm@redhat.com> | |
849 | ||
850 | * Initial creation | |
851 | ||
852 | \f | |
853 | Copyright (C) 2019-2020 Free Software Foundation, Inc. | |
854 | ||
855 | Copying and distribution of this file, with or without modification, | |
856 | are permitted in any medium without royalty provided the copyright | |
857 | notice and this notice are preserved. |