]>
Commit | Line | Data |
---|---|---|
2900f2f2 GA |
1 | 2021-01-29 David Malcolm <dmalcolm@redhat.com> |
2 | ||
3 | * checker-path.cc (event_kind_to_string): Handle | |
4 | EK_START_CONSOLIDATED_CFG_EDGES and | |
5 | EK_END_CONSOLIDATED_CFG_EDGES. | |
6 | (start_consolidated_cfg_edges_event::get_desc): New. | |
7 | (checker_path::cfg_edge_pair_at_p): New. | |
8 | * checker-path.h (enum event_kind): Add | |
9 | EK_START_CONSOLIDATED_CFG_EDGES and | |
10 | EK_END_CONSOLIDATED_CFG_EDGES. | |
11 | (class start_consolidated_cfg_edges_event): New class. | |
12 | (class end_consolidated_cfg_edges_event): New class. | |
13 | (checker_path::delete_events): New. | |
14 | (checker_path::replace_event): New. | |
15 | (checker_path::cfg_edge_pair_at_p): New decl. | |
16 | * diagnostic-manager.cc (diagnostic_manager::prune_path): Call | |
17 | consolidate_conditions. | |
18 | (same_line_as_p): New. | |
19 | (diagnostic_manager::consolidate_conditions): New. | |
20 | * diagnostic-manager.h | |
21 | (diagnostic_manager::consolidate_conditions): New decl. | |
22 | ||
ef1f8ee6 GA |
23 | 2021-01-18 David Malcolm <dmalcolm@redhat.com> |
24 | ||
25 | * analyzer.h (is_std_named_call_p): New decl. | |
26 | * diagnostic-manager.cc (path_builder::get_sm): New. | |
27 | (state_change_event_creator::state_change_event_creator): Add "pb" | |
28 | param. | |
29 | (state_change_event_creator::on_global_state_change): Don't consider | |
30 | state changes affecting other state_machines. | |
31 | (state_change_event_creator::on_state_change): Likewise. | |
32 | (state_change_event_creator::m_pb): New field. | |
33 | (diagnostic_manager::add_events_for_eedge): Pass pb to visitor | |
34 | ctor. | |
35 | * region-model-impl-calls.cc | |
36 | (region_model::impl_deallocation_call): New. | |
37 | * region-model.cc: Include "attribs.h". | |
38 | (region_model::on_call_post): Handle fndecls referenced by | |
39 | __attribute__((deallocated_by(FOO))). | |
40 | * region-model.h (region_model::impl_deallocation_call): New decl. | |
41 | * sm-malloc.cc: Include "stringpool.h" and "attribs.h". Add | |
42 | leading comment. | |
43 | (class api): Delete. | |
44 | (enum resource_state): Update comment for change from api to | |
45 | deallocator and deallocator_set. | |
46 | (allocation_state::allocation_state): Drop api param. Add | |
47 | "deallocators" and "deallocator". | |
48 | (allocation_state::m_api): Drop field in favor of... | |
49 | (allocation_state::m_deallocators): New field. | |
50 | (allocation_state::m_deallocator): New field. | |
51 | (enum wording): Add WORDING_DEALLOCATED. | |
52 | (struct deallocator): New. | |
53 | (struct standard_deallocator): New. | |
54 | (struct custom_deallocator): New. | |
55 | (struct deallocator_set): New. | |
56 | (struct custom_deallocator_set): New. | |
57 | (struct standard_deallocator_set): New. | |
58 | (struct deallocator_set_map_traits): New. | |
59 | (malloc_state_machine::m_malloc): Drop field | |
60 | (malloc_state_machine::m_scalar_new): Likewise. | |
61 | (malloc_state_machine::m_vector_new): Likewise. | |
62 | (malloc_state_machine::m_free): New field | |
63 | (malloc_state_machine::m_scalar_delete): Likewise. | |
64 | (malloc_state_machine::m_vector_delete): Likewise. | |
65 | (malloc_state_machine::deallocator_map_t): New typedef. | |
66 | (malloc_state_machine::m_deallocator_map): New field. | |
67 | (malloc_state_machine::deallocator_set_cache_t): New typedef. | |
68 | (malloc_state_machine::m_custom_deallocator_set_cache): New field. | |
69 | (malloc_state_machine::custom_deallocator_set_map_t): New typedef. | |
70 | (malloc_state_machine::m_custom_deallocator_set_map): New field. | |
71 | (malloc_state_machine::m_dynamic_sets): New field. | |
72 | (malloc_state_machine::m_dynamic_deallocators): New field. | |
73 | (api::api): Delete. | |
74 | (deallocator::deallocator): New ctor. | |
75 | (deallocator::hash): New. | |
76 | (deallocator::dump_to_pp): New. | |
77 | (deallocator::cmp): New. | |
78 | (deallocator::cmp_ptr_ptr): New. | |
79 | (standard_deallocator::standard_deallocator): New ctor. | |
80 | (deallocator_set::deallocator_set): New ctor. | |
81 | (deallocator_set::dump): New. | |
82 | (custom_deallocator_set::custom_deallocator_set): New ctor. | |
83 | (custom_deallocator_set::contains_p): New. | |
84 | (custom_deallocator_set::maybe_get_single): New. | |
85 | (custom_deallocator_set::dump_to_pp): New. | |
86 | (standard_deallocator_set::standard_deallocator_set): New ctor. | |
87 | (standard_deallocator_set::contains_p): New. | |
88 | (standard_deallocator_set::maybe_get_single): New. | |
89 | (standard_deallocator_set::dump_to_pp): New. | |
90 | (start_p): New. | |
91 | (class mismatching_deallocation): Update for conversion from api | |
92 | to deallocator_set and deallocator. | |
93 | (double_free::emit): Use %qs. | |
94 | (class use_after_free): Update for conversion from api to | |
95 | deallocator_set and deallocator. | |
96 | (malloc_leak::describe_state_change): Only emit "allocated here" on | |
97 | a start->nonnull transition, rather than on other transitions to | |
98 | nonnull. | |
99 | (allocation_state::dump_to_pp): Update for conversion from api to | |
100 | deallocator_set. | |
101 | (allocation_state::get_nonnull): Likewise. | |
102 | (malloc_state_machine::malloc_state_machine): Likewise. | |
103 | (malloc_state_machine::~malloc_state_machine): New. | |
104 | (malloc_state_machine::add_state): Update for conversion from api | |
105 | to deallocator_set. | |
106 | (malloc_state_machine::get_or_create_custom_deallocator_set): New. | |
107 | (malloc_state_machine::maybe_create_custom_deallocator_set): New. | |
108 | (malloc_state_machine::get_or_create_deallocator): New. | |
109 | (malloc_state_machine::on_stmt): Update for conversion from api | |
110 | to deallocator_set. Handle "__attribute__((malloc(FOO)))", and | |
111 | the special attribute set on FOO. | |
112 | (malloc_state_machine::on_allocator_call): Update for conversion | |
113 | from api to deallocator_set. Add "returns_nonnull" param and use | |
114 | it to affect which state to transition to. | |
115 | (malloc_state_machine::on_deallocator_call): Update for conversion | |
116 | from api to deallocator_set. | |
117 | ||
5fff80fd GA |
118 | 2021-01-14 David Malcolm <dmalcolm@redhat.com> |
119 | ||
120 | * engine.cc (strongly_connected_components::to_json): New. | |
121 | (worklist::to_json): New. | |
122 | (exploded_graph::to_json): JSON-ify the worklist. | |
123 | * exploded-graph.h (strongly_connected_components::to_json): New | |
124 | decl. | |
125 | (worklist::to_json): New decl. | |
126 | * store.cc (store::to_json): Fix comment. | |
127 | * supergraph.cc (supernode::to_json): Fix reference to | |
128 | "returning_call" in comment. Add optional "fun" to JSON. | |
129 | (edge_kind_to_string): New. | |
130 | (superedge::to_json): Add "kind" to JSON. | |
131 | ||
132 | 2021-01-14 David Malcolm <dmalcolm@redhat.com> | |
133 | ||
134 | PR analyzer/98679 | |
135 | * analyzer.h (region_offset::operator==): Make const. | |
136 | * pending-diagnostic.h (pending_diagnostic::equal_p): Likewise. | |
137 | * store.h (binding_cluster::for_each_value): Likewise. | |
138 | (binding_cluster::for_each_binding): Likewise. | |
139 | ||
6851dda2 GA |
140 | 2021-01-12 David Malcolm <dmalcolm@redhat.com> |
141 | ||
142 | PR analyzer/98628 | |
143 | * store.cc (binding_cluster::make_unknown_relative_to): Don't mark | |
144 | dereferenced unknown pointers as having escaped. | |
145 | ||
7d187e4f GA |
146 | 2021-01-07 David Malcolm <dmalcolm@redhat.com> |
147 | ||
148 | PR analyzer/98580 | |
149 | * region.cc (decl_region::get_svalue_for_initializer): Gracefully | |
150 | handle when LTO writes out DECL_INITIAL as error_mark_node. | |
151 | ||
152 | 2021-01-07 David Malcolm <dmalcolm@redhat.com> | |
153 | ||
154 | PR analyzer/97074 | |
155 | * store.cc (binding_cluster::can_merge_p): Add "out_store" param | |
156 | and pass to calls to binding_cluster::make_unknown_relative_to. | |
157 | (binding_cluster::make_unknown_relative_to): Add "out_store" | |
158 | param. Use it to mark base regions that are pointed to by | |
159 | pointers that become unknown as having escaped. | |
160 | (store::can_merge_p): Pass out_store to | |
161 | binding_cluster::can_merge_p. | |
162 | * store.h (binding_cluster::can_merge_p): Add "out_store" param. | |
163 | (binding_cluster::make_unknown_relative_to): Likewise. | |
164 | * svalue.cc (region_svalue::implicitly_live_p): New vfunc. | |
165 | * svalue.h (region_svalue::implicitly_live_p): New vfunc decl. | |
166 | ||
167 | 2021-01-07 David Malcolm <dmalcolm@redhat.com> | |
168 | ||
169 | PR analyzer/98564 | |
170 | * engine.cc (exploded_path::feasible_p): Add missing call to | |
171 | bitmap_clear. | |
172 | ||
942ae5be GA |
173 | 2021-01-06 David Malcolm <dmalcolm@redhat.com> |
174 | ||
175 | PR analyzer/97072 | |
176 | * region-model-reachability.cc (reachable_regions::init_cluster): | |
177 | Convert symbolic region handling to a switch statement. Add cases | |
178 | to handle SK_UNKNOWN and SK_CONJURED. | |
179 | ||
651b8a50 GA |
180 | 2021-01-05 David Malcolm <dmalcolm@redhat.com> |
181 | ||
182 | PR analyzer/98293 | |
183 | * store.cc (binding_map::apply_ctor_to_region): When "index" is | |
184 | NULL, iterate through the fields for RECORD_TYPEs, rather than | |
185 | creating an INTEGER_CST index. | |
186 | ||
94358e47 GA |
187 | 2020-11-30 David Malcolm <dmalcolm@redhat.com> |
188 | ||
189 | * analyzer-pass.cc: Include "analyzer/analyzer.h" for the | |
190 | declaration of sorry_no_analyzer; include "tree.h" and | |
191 | "function.h" as these are needed by it. | |
192 | ||
193 | 2020-11-30 David Malcolm <dmalcolm@redhat.com> | |
194 | ||
195 | * analyzer-pass.cc (pass_analyzer::execute): Move sorry call to... | |
196 | (sorry_no_analyzer): New. | |
197 | * analyzer.h (class state_machine): New forward decl. | |
198 | (class logger): New forward decl. | |
199 | (class plugin_analyzer_init_iface): New. | |
200 | (sorry_no_analyzer): New decl. | |
201 | * checker-path.cc (checker_path::fixup_locations): New. | |
202 | * checker-path.h (checker_event::set_location): New. | |
203 | (checker_path::fixup_locations): New decl. | |
204 | * diagnostic-manager.cc | |
205 | (diagnostic_manager::emit_saved_diagnostic): Call | |
206 | checker_path::fixup_locations, and call fixup_location | |
207 | on the primary location. | |
208 | * engine.cc: Include "plugin.h". | |
209 | (class plugin_analyzer_init_impl): New. | |
210 | (impl_run_checkers): Invoke PLUGIN_ANALYZER_INIT callbacks. | |
211 | * pending-diagnostic.h (pending_diagnostic::fixup_location): New | |
212 | vfunc. | |
213 | ||
25bb75f8 GA |
214 | 2020-11-18 David Malcolm <dmalcolm@redhat.com> |
215 | ||
216 | PR analyzer/97893 | |
217 | * sm-malloc.cc (null_deref::emit): Use CWE-476 rather than | |
218 | CWE-690, as this isn't due to an unchecked return value. | |
219 | (null_arg::emit): Likewise. | |
220 | ||
a5a11525 GA |
221 | 2020-11-12 David Malcolm <dmalcolm@redhat.com> |
222 | ||
223 | * checker-path.h (checker_event::get_id_ptr): New. | |
224 | * diagnostic-manager.cc (path_builder::path_builder): Add "sd" | |
225 | param and use it to initialize new field "m_sd". | |
226 | (path_builder::get_pending_diagnostic): New. | |
227 | (path_builder::m_sd): New field. | |
228 | (diagnostic_manager::emit_saved_diagnostic): Pass sd to | |
229 | path_builder ctor. | |
230 | (diagnostic_manager::add_events_for_superedge): Call new | |
231 | maybe_add_custom_events_for_superedge vfunc. | |
232 | * engine.cc (stale_jmp_buf::stale_jmp_buf): Add "setjmp_point" | |
233 | param and use it to initialize new field "m_setjmp_point". | |
234 | Initialize new field "m_stack_pop_event". | |
235 | (stale_jmp_buf::maybe_add_custom_events_for_superedge): New vfunc | |
236 | implementation. | |
237 | (stale_jmp_buf::describe_final_event): New vfunc implementation. | |
238 | (stale_jmp_buf::m_setjmp_point): New field. | |
239 | (stale_jmp_buf::m_stack_pop_event): New field. | |
240 | (exploded_node::on_longjmp): Pass setjmp_point to stale_jmp_buf | |
241 | ctor. | |
242 | * pending-diagnostic.h | |
243 | (pending_diagnostic::maybe_add_custom_events_for_superedge): New | |
244 | vfunc. | |
245 | ||
246 | 2020-11-12 David Malcolm <dmalcolm@redhat.com> | |
247 | ||
248 | PR tree-optimization/97424 | |
249 | * analyzer.opt (Wanalyzer-shift-count-negative): New. | |
250 | (Wanalyzer-shift-count-overflow): New. | |
251 | * region-model.cc (class shift_count_negative_diagnostic): New. | |
252 | (class shift_count_overflow_diagnostic): New. | |
253 | (region_model::get_gassign_result): Complain about shift counts that | |
254 | are negative or are >= the operand's type's width. | |
255 | ||
bb622641 GA |
256 | 2020-11-10 Martin Liska <mliska@suse.cz> |
257 | ||
258 | * constraint-manager.cc (constraint_manager::merge): Remove | |
259 | unused code. | |
260 | * constraint-manager.h: Likewise. | |
261 | * program-state.cc (sm_state_map::sm_state_map): Likewise. | |
262 | (program_state::program_state): Likewise. | |
263 | (test_sm_state_map): Likewise. | |
264 | * program-state.h: Likewise. | |
265 | * region-model-reachability.cc (reachable_regions::reachable_regions): Likewise. | |
266 | * region-model-reachability.h: Likewise. | |
267 | * region-model.cc (region_model::handle_unrecognized_call): Likewise. | |
268 | (region_model::get_reachable_svalues): Likewise. | |
269 | (region_model::can_merge_with_p): Likewise. | |
270 | ||
0cfd9109 GA |
271 | 2020-11-05 David Malcolm <dmalcolm@redhat.com> |
272 | ||
273 | PR analyzer/97668 | |
274 | * svalue.cc (cmp_cst): Handle COMPLEX_CST. | |
275 | ||
e93aae4a GA |
276 | 2020-10-29 David Malcolm <dmalcolm@redhat.com> |
277 | ||
278 | * program-state.cc (sm_state_map::on_liveness_change): Sort the | |
279 | leaking svalues before calling on_state_leak. | |
280 | (program_state::detect_leaks): Likewise when calling | |
281 | on_svalue_leak. | |
282 | * region-model-reachability.cc | |
283 | (reachable_regions::mark_escaped_clusters): Likewise when | |
284 | calling on_escaped_function. | |
285 | ||
286 | 2020-10-29 David Malcolm <dmalcolm@redhat.com> | |
287 | ||
288 | PR analyzer/97608 | |
289 | * region-model-reachability.cc (reachable_regions::handle_sval): | |
290 | Operands of reachable reversible operations are reachable. | |
291 | ||
292 | 2020-10-29 David Malcolm <dmalcolm@redhat.com> | |
293 | ||
294 | * analyzer.h (class state_machine): New forward decl. | |
295 | (class logger): Likewise. | |
296 | (class visitor): Likewise. | |
297 | * complexity.cc: New file, taken from svalue.cc. | |
298 | * complexity.h: New file, taken from region-model.h. | |
299 | * region-model.h: Include "analyzer/svalue.h" and | |
300 | "analyzer/region.h". Move struct complexity to complexity.h. | |
301 | Move svalue, its subclasses and supporting decls to svalue.h. | |
302 | Move region, its subclasses and supporting decls to region.h. | |
303 | * region.cc: Include "analyzer/region.h". | |
304 | (symbolic_region::symbolic_region): Move here from region-model.h. | |
305 | * region.h: New file, based on material from region-model.h. | |
306 | * svalue.cc: Include "analyzer/svalue.h". | |
307 | (complexity::complexity): Move to complexity.cc. | |
308 | (complexity::from_pair): Likewise. | |
309 | * svalue.h: New file, based on material from region-model.h. | |
310 | ||
311 | 2020-10-29 David Malcolm <dmalcolm@redhat.com> | |
312 | ||
313 | * program-state.cc (sm_state_map::print): Guard the printing of | |
314 | the origin pointer with !flag_dump_noaddr. | |
315 | * region.cc (string_region::dump_to_pp): Likewise for | |
316 | m_string_cst. | |
317 | ||
89bb01e7 GA |
318 | 2020-10-27 David Malcolm <dmalcolm@redhat.com> |
319 | ||
320 | PR analyzer/97568 | |
321 | * region-model.cc (region_model::get_initial_value_for_global): | |
322 | Move check that !DECL_EXTERNAL from here to... | |
323 | * region.cc (decl_region::get_svalue_for_initializer): ...here, | |
324 | using it to reject zero initialization. | |
325 | ||
326 | 2020-10-27 Markus Böck <markus.boeck02@gmail.com> | |
327 | ||
328 | PR analyzer/96608 | |
329 | * store.h (hash): Cast to intptr_t instead of long | |
330 | ||
331 | 2020-10-27 David Malcolm <dmalcolm@redhat.com> | |
332 | ||
333 | * constraint-manager.cc (svalue_cmp_by_ptr): Delete. | |
334 | (equiv_class::canonicalize): Use svalue::cmp_ptr_ptr instead. | |
335 | (equiv_class_cmp): Eliminate pointer comparison. | |
336 | * diagnostic-manager.cc (dedupe_key::comparator): If they are at | |
337 | the same location, also compare epath ength and pending_diagnostic | |
338 | kind. | |
339 | * engine.cc (readability_comparator): If two path_vars have the | |
340 | same readability, then impose an arbitrary ordering on them. | |
341 | (worklist::key_t::cmp): If two points have the same plan ordering, | |
342 | continue the comparison. Call sm_state_map::cmp rather than | |
343 | comparing hash values. | |
344 | * program-state.cc (sm_state_map::entry_t::cmp): New. | |
345 | (sm_state_map::cmp): New. | |
346 | * program-state.h (sm_state_map::entry_t::cmp): New decl. | |
347 | (sm_state_map::elements): New. | |
348 | (sm_state_map::cmp): New. | |
349 | ||
350 | 2020-10-27 David Malcolm <dmalcolm@redhat.com> | |
351 | ||
352 | * engine.cc (setjmp_record::cmp): New. | |
353 | (supernode_cluster::dump_dot): Avoid embedding pointer in cluster | |
354 | name. | |
355 | (supernode_cluster::cmp_ptr_ptr): New. | |
356 | (function_call_string_cluster::dump_dot): Avoid embedding pointer | |
357 | in cluster name. Sort m_map when dumping child clusters. | |
358 | (function_call_string_cluster::cmp_ptr_ptr): New. | |
359 | (root_cluster::dump_dot): Sort m_map when dumping child clusters. | |
360 | * program-point.cc (function_point::cmp): New. | |
361 | (function_point::cmp_ptr): New. | |
362 | * program-point.h (function_point::cmp): New decl. | |
363 | (function_point::cmp_ptr): New decl. | |
364 | * program-state.cc (sm_state_map::print): Sort the values. Guard | |
365 | the printing of pointers with !flag_dump_noaddr. | |
366 | (program_state::prune_for_point): Sort the regions. | |
367 | (log_set_of_svalues): Sort the values. Guard the printing of | |
368 | pointers with !flag_dump_noaddr. | |
369 | * region-model-manager.cc (log_uniq_map): Sort the values. | |
370 | * region-model-reachability.cc (dump_set): New function template. | |
371 | (reachable_regions::dump_to_pp): Use it. | |
372 | * region-model.h (svalue::cmp_ptr): New decl. | |
373 | (svalue::cmp_ptr_ptr): New decl. | |
374 | (setjmp_record::cmp): New decl. | |
375 | (placeholder_svalue::get_name): New accessor. | |
376 | (widening_svalue::get_point): New accessor. | |
377 | (compound_svalue::get_map): New accessor. | |
378 | (conjured_svalue::get_stmt): New accessor. | |
379 | (conjured_svalue::get_id_region): New accessor. | |
380 | (region::cmp_ptrs): Rename to... | |
381 | (region::cmp_ptr_ptr): ...this. | |
382 | * region.cc (region::cmp_ptrs): Rename to... | |
383 | (region::cmp_ptr_ptr): ...this. | |
384 | * state-purge.cc | |
385 | (state_purge_per_ssa_name::state_purge_per_ssa_name): Sort | |
386 | m_points_needing_name when dumping. | |
387 | * store.cc (concrete_binding::cmp_ptr_ptr): New. | |
388 | (symbolic_binding::cmp_ptr_ptr): New. | |
389 | (binding_map::cmp): New. | |
390 | (get_sorted_parent_regions): Update for renaming of | |
391 | region::cmp_ptrs to region::cmp_ptr_ptr. | |
392 | (store::dump_to_pp): Likewise. | |
393 | (store::to_json): Likewise. | |
394 | (store::can_merge_p): Sort the base regions before considering | |
395 | them. | |
396 | * store.h (concrete_binding::cmp_ptr_ptr): New decl. | |
397 | (symbolic_binding::cmp_ptr_ptr): New decl. | |
398 | (binding_map::cmp): New decl. | |
399 | * supergraph.cc (supergraph::supergraph): Assign UIDs to the | |
400 | gimple stmts. | |
401 | * svalue.cc (cmp_cst): New. | |
402 | (svalue::cmp_ptr): New. | |
403 | (svalue::cmp_ptr_ptr): New. | |
404 | ||
405 | 2020-10-27 David Malcolm <dmalcolm@redhat.com> | |
406 | ||
407 | * engine.cc (exploded_graph::get_or_create_node): Fix off-by-one | |
408 | when imposing param_analyzer_max_enodes_per_program_point limit. | |
409 | ||
410 | 2020-10-27 David Malcolm <dmalcolm@redhat.com> | |
411 | ||
412 | * region-model.cc (region_model::get_representative_path_var): | |
413 | Implement case RK_LABEL. | |
414 | * region-model.h (label_region::get_label): New accessor. | |
415 | ||
43868df3 GA |
416 | 2020-10-22 David Malcolm <dmalcolm@redhat.com> |
417 | ||
418 | PR analyzer/97514 | |
419 | * engine.cc (exploded_graph::add_function_entry): Handle failure | |
420 | to create an enode, rather than asserting. | |
421 | ||
422 | 2020-10-22 David Malcolm <dmalcolm@redhat.com> | |
423 | ||
424 | PR analyzer/97489 | |
425 | * engine.cc (exploded_graph::add_function_entry): Assert that we | |
426 | have a function body. | |
427 | (exploded_graph::on_escaped_function): Reject fndecls that don't | |
428 | have a function body. | |
429 | ||
b2698c21 GA |
430 | 2020-10-14 David Malcolm <dmalcolm@redhat.com> |
431 | ||
432 | PR analyzer/93388 | |
433 | * region-model.cc (region_model::get_initial_value_for_global): | |
434 | Fall back to returning an initial_svalue if | |
435 | decl_region::get_svalue_for_initializer fails. | |
436 | * region.cc (decl_region::get_svalue_for_initializer): Don't | |
437 | attempt to create a compound_svalue if the region has an unknown | |
438 | size. | |
439 | ||
440 | 2020-10-14 David Malcolm <dmalcolm@redhat.com> | |
441 | ||
442 | PR analyzer/93723 | |
443 | * store.cc (binding_map::apply_ctor_to_region): Remove redundant | |
444 | assertion. | |
445 | ||
8be127ca GA |
446 | 2020-10-12 David Malcolm <dmalcolm@redhat.com> |
447 | ||
448 | PR analyzer/97258 | |
449 | * engine.cc (impl_region_model_context::on_escaped_function): New | |
450 | vfunc. | |
451 | (exploded_graph::add_function_entry): Use m_functions_with_enodes | |
452 | to implement idempotency. | |
453 | (add_any_callbacks): New. | |
454 | (exploded_graph::build_initial_worklist): Use the above to find | |
455 | callbacks that are reachable from global initializers. | |
456 | (exploded_graph::on_escaped_function): New. | |
457 | * exploded-graph.h | |
458 | (impl_region_model_context::on_escaped_function): New decl. | |
459 | (exploded_graph::on_escaped_function): New decl. | |
460 | (exploded_graph::m_functions_with_enodes): New field. | |
461 | * region-model-reachability.cc | |
462 | (reachable_regions::reachable_regions): Replace "store" param with | |
463 | "model" param; use it to initialize m_model. | |
464 | (reachable_regions::add): When getting the svalue for the region, | |
465 | call get_store_value on the model rather than using an initial | |
466 | value. | |
467 | (reachable_regions::mark_escaped_clusters): Add ctxt param and | |
468 | use it to call on_escaped_function when a function_region escapes. | |
469 | * region-model-reachability.h | |
470 | (reachable_regions::reachable_regions): Replace "store" param with | |
471 | "model" param. | |
472 | (reachable_regions::mark_escaped_clusters): Add ctxt param. | |
473 | (reachable_regions::m_model): New field. | |
474 | * region-model.cc (region_model::handle_unrecognized_call): Update | |
475 | for change in reachable_regions ctor. | |
476 | (region_model::handle_unrecognized_call): Pass ctxt to | |
477 | mark_escaped_clusters. | |
478 | (region_model::get_reachable_svalues): Update for change in | |
479 | reachable_regions ctor. | |
480 | (region_model::get_initial_value_for_global): Read-only variables | |
481 | keep their initial values. | |
482 | * region-model.h (region_model_context::on_escaped_function): New | |
483 | vfunc. | |
484 | (noop_region_model_context::on_escaped_function): New. | |
485 | ||
486 | 2020-10-12 David Malcolm <dmalcolm@redhat.com> | |
487 | ||
488 | * analyzer.opt (Wanalyzer-write-to-const): New. | |
489 | (Wanalyzer-write-to-string-literal): New. | |
490 | * region-model-impl-calls.cc (region_model::impl_call_memcpy): | |
491 | Call check_for_writable_region. | |
492 | (region_model::impl_call_memset): Likewise. | |
493 | (region_model::impl_call_strcpy): Likewise. | |
494 | * region-model.cc (class write_to_const_diagnostic): New. | |
495 | (class write_to_string_literal_diagnostic): New. | |
496 | (region_model::check_for_writable_region): New. | |
497 | (region_model::set_value): Call check_for_writable_region. | |
498 | * region-model.h (region_model::check_for_writable_region): New | |
499 | decl. | |
500 | ||
6caec77e GA |
501 | 2020-10-07 David Malcolm <dmalcolm@redhat.com> |
502 | ||
503 | PR analyzer/97116 | |
504 | * sm-malloc.cc (method_p): New. | |
505 | (describe_argument_index): New. | |
506 | (inform_nonnull_attribute): Use describe_argument_index. | |
507 | (possible_null_arg::describe_final_event): Likewise. | |
508 | (null_arg::describe_final_event): Likewise. | |
509 | ||
93bca37c GA |
510 | 2020-09-29 David Malcolm <dmalcolm@redhat.com> |
511 | ||
512 | PR analyzer/95188 | |
513 | * engine.cc (stmt_requires_new_enode_p): Split enodes before | |
514 | "signal" calls. | |
515 | ||
516 | 2020-09-29 David Malcolm <dmalcolm@redhat.com> | |
517 | ||
518 | * constraint-manager.cc | |
519 | (constraint_manager::add_constraint_internal): Whitespace fixes. | |
520 | Silence -Wsign-compare warning. | |
521 | * engine.cc (maybe_process_run_of_before_supernode_enodes): | |
522 | Silence -Wsign-compare warning. | |
523 | ||
e84761c6 GA |
524 | 2020-09-28 David Malcolm <dmalcolm@redhat.com> |
525 | ||
526 | * region-model.h (binop_svalue::dyn_cast_binop_svalue): Remove | |
527 | redundant "virtual". Add FINAL OVERRIDE. | |
528 | (widening_svalue::dyn_cast_widening_svalue): Add FINAL OVERRIDE. | |
529 | (compound_svalue::dyn_cast_compound_svalue): Likewise. | |
530 | (conjured_svalue::dyn_cast_conjured_svalue): Likewise. | |
531 | ||
532 | 2020-09-28 David Malcolm <dmalcolm@redhat.com> | |
533 | ||
534 | * diagnostic-manager.cc (null_assignment_sm_context::m_visitor): | |
535 | Remove unused field. | |
536 | ||
537 | 2020-09-28 David Malcolm <dmalcolm@redhat.com> | |
538 | ||
539 | PR analyzer/97233 | |
540 | * analyzer.cc (is_longjmp_call_p): Require the initial argument | |
541 | to be a pointer. | |
542 | * engine.cc (exploded_node::on_longjmp): Likewise. | |
543 | ||
544 | 2020-09-28 David Malcolm <dmalcolm@redhat.com> | |
545 | ||
546 | * program-state.cc (sm_state_map::print): Update check | |
547 | for m_global_state being the start state. | |
548 | ||
91dd4a38 GA |
549 | 2020-09-26 David Malcolm <dmalcolm@redhat.com> |
550 | ||
551 | PR analyzer/96646 | |
552 | PR analyzer/96841 | |
553 | * region-model.cc (region_model::get_representative_path_var): | |
554 | When handling offset_region, wrap the MEM_REF's first argument in | |
555 | an ADDR_EXPR of pointer type, rather than simply using the tree | |
556 | for the parent region. Require the MEM_REF's second argument to | |
557 | be an integer constant. | |
558 | ||
a2b7397b GA |
559 | 2020-09-24 David Malcolm <dmalcolm@redhat.com> |
560 | ||
561 | * analyzer.h (struct rejected_constraint): New decl. | |
562 | * analyzer.opt (fanalyzer-feasibility): New option. | |
563 | * diagnostic-manager.cc (path_builder::path_builder): Add | |
564 | "problem" param and use it to initialize new field. | |
565 | (path_builder::get_feasibility_problem): New accessor. | |
566 | (path_builder::m_feasibility_problem): New field. | |
567 | (dedupe_winners::add): Remove inversion of logic in "if" clause, | |
568 | swapping if/else suites. In the !feasible_p suite, inspect | |
569 | flag_analyzer_feasibility and add code to handle when this | |
570 | is off, accepting the infeasible path, but recording the | |
571 | feasibility_problem. | |
572 | (diagnostic_manager::emit_saved_diagnostic): Pass the | |
573 | feasibility_problem to the path_builder. | |
574 | (diagnostic_manager::add_events_for_eedge): If we have | |
575 | a feasibility_problem at this edge, use it to add a custom event. | |
576 | * engine.cc (exploded_path::feasible_p): Pass a | |
577 | rejected_constraint ** to model.maybe_update_for_edge and transfer | |
578 | ownership of any created instance to any feasibility_problem. | |
579 | (feasibility_problem::dump_to_pp): New. | |
580 | * exploded-graph.h (feasibility_problem::feasibility_problem): | |
581 | Drop "model" param; add rejected_constraint * param. | |
582 | (feasibility_problem::~feasibility_problem): New. | |
583 | (feasibility_problem::dump_to_pp): New decl. | |
584 | (feasibility_problem::m_model): Drop field. | |
585 | (feasibility_problem::m_rc): New field. | |
586 | * program-point.cc (function_point::get_location): Handle | |
587 | PK_BEFORE_SUPERNODE and PK_AFTER_SUPERNODE. | |
588 | * program-state.cc (program_state::on_edge): Pass NULL to new | |
589 | param of region_model::maybe_update_for_edge. | |
590 | * region-model.cc (region_model::add_constraint): New overload | |
591 | adding a rejected_constraint ** param. | |
592 | (region_model::maybe_update_for_edge): Add rejected_constraint ** | |
593 | param and pass it to the various apply_constraints_for_ calls. | |
594 | (region_model::apply_constraints_for_gcond): Add | |
595 | rejected_constraint ** param and pass it to add_constraint calls. | |
596 | (region_model::apply_constraints_for_gswitch): Likewise. | |
597 | (region_model::apply_constraints_for_exception): Likewise. | |
598 | (rejected_constraint::dump_to_pp): New. | |
599 | * region-model.h (region_model::maybe_update_for_edge): | |
600 | Add rejected_constraint ** param. | |
601 | (region_model::add_constraint): New overload adding a | |
602 | rejected_constraint ** param. | |
603 | (region_model::apply_constraints_for_gcond): Add | |
604 | rejected_constraint ** param. | |
605 | (region_model::apply_constraints_for_gswitch): Likewise. | |
606 | (region_model::apply_constraints_for_exception): Likewise. | |
607 | (struct rejected_constraint): New. | |
608 | ||
82b77dee GA |
609 | 2020-09-23 David Malcolm <dmalcolm@redhat.com> |
610 | ||
611 | PR analyzer/97178 | |
612 | * engine.cc (impl_run_checkers): Update for change to ext_state | |
613 | ctor. | |
614 | * program-state.cc (selftest::test_sm_state_map): Pass an engine | |
615 | instance to ext_state ctor. | |
616 | (selftest::test_program_state_1): Likewise. | |
617 | (selftest::test_program_state_2): Likewise. | |
618 | (selftest::test_program_state_merging): Likewise. | |
619 | (selftest::test_program_state_merging_2): Likewise. | |
620 | * program-state.h (extrinsic_state::extrinsic_state): Remove NULL | |
621 | default value for "eng" param. | |
622 | ||
623 | 2020-09-23 Tobias Burnus <tobias@codesourcery.com> | |
624 | ||
625 | * analyzer-logging.cc: Guard '#pragma ... ignored "-Wformat-diag"' | |
626 | by '#if __GNUC__ >= 10' | |
627 | * analyzer.h: Likewise. | |
628 | * call-string.cc: Likewise. | |
629 | ||
630 | 2020-09-23 David Malcolm <dmalcolm@redhat.com> | |
631 | ||
632 | * engine.cc (exploded_node::on_stmt): Replace sequence of dyn_cast | |
633 | with switch. | |
634 | ||
521d2711 GA |
635 | 2020-09-22 David Malcolm <dmalcolm@redhat.com> |
636 | ||
637 | * analysis-plan.cc: Include "json.h". | |
638 | * analyzer.opt (fdump-analyzer-json): New. | |
639 | * call-string.cc: Include "json.h". | |
640 | (call_string::to_json): New. | |
641 | * call-string.h (call_string::to_json): New decl. | |
642 | * checker-path.cc: Include "json.h". | |
643 | * constraint-manager.cc: Include "json.h". | |
644 | (equiv_class::to_json): New. | |
645 | (constraint::to_json): New. | |
646 | (constraint_manager::to_json): New. | |
647 | * constraint-manager.h (equiv_class::to_json): New decl. | |
648 | (constraint::to_json): New decl. | |
649 | (constraint_manager::to_json): New decl. | |
650 | * diagnostic-manager.cc: Include "json.h". | |
651 | (saved_diagnostic::to_json): New. | |
652 | (diagnostic_manager::to_json): New. | |
653 | * diagnostic-manager.h (saved_diagnostic::to_json): New decl. | |
654 | (diagnostic_manager::to_json): New decl. | |
655 | * engine.cc: Include "json.h", <zlib.h>. | |
656 | (exploded_node::status_to_str): New. | |
657 | (exploded_node::to_json): New. | |
658 | (exploded_edge::to_json): New. | |
659 | (exploded_graph::to_json): New. | |
660 | (dump_analyzer_json): New. | |
661 | (impl_run_checkers): Call it. | |
662 | * exploded-graph.h (exploded_node::status_to_str): New decl. | |
663 | (exploded_node::to_json): New. | |
664 | (exploded_edge::to_json): New. | |
665 | (exploded_graph::to_json): New. | |
666 | * pending-diagnostic.cc: Include "json.h". | |
667 | * program-point.cc: Include "json.h". | |
668 | (program_point::to_json): New. | |
669 | * program-point.h (program_point::to_json): New decl. | |
670 | * program-state.cc: Include "json.h". | |
671 | (extrinsic_state::to_json): New. | |
672 | (sm_state_map::to_json): New. | |
673 | (program_state::to_json): New. | |
674 | * program-state.h (extrinsic_state::to_json): New decl. | |
675 | (sm_state_map::to_json): New decl. | |
676 | (program_state::to_json): New decl. | |
677 | * region-model-impl-calls.cc: Include "json.h". | |
678 | * region-model-manager.cc: Include "json.h". | |
679 | * region-model-reachability.cc: Include "json.h". | |
680 | * region-model.cc: Include "json.h". | |
681 | * region-model.h (svalue::to_json): New decl. | |
682 | (region::to_json): New decl. | |
683 | * region.cc: Include "json.h". | |
684 | (region::to_json: New. | |
685 | * sm-file.cc: Include "json.h". | |
686 | * sm-malloc.cc: Include "json.h". | |
687 | * sm-pattern-test.cc: Include "json.h". | |
688 | * sm-sensitive.cc: Include "json.h". | |
689 | * sm-signal.cc: Include "json.h". | |
690 | (signal_delivery_edge_info_t::to_json): New. | |
691 | * sm-taint.cc: Include "json.h". | |
692 | * sm.cc: Include "diagnostic.h", "tree-diagnostic.h", and | |
693 | "json.h". | |
694 | (state_machine::state::to_json): New. | |
695 | (state_machine::to_json): New. | |
696 | * sm.h (state_machine::state::to_json): New. | |
697 | (state_machine::to_json): New. | |
698 | * state-purge.cc: Include "json.h". | |
699 | * store.cc: Include "json.h". | |
700 | (binding_key::get_desc): New. | |
701 | (binding_map::to_json): New. | |
702 | (binding_cluster::to_json): New. | |
703 | (store::to_json): New. | |
704 | * store.h (binding_key::get_desc): New decl. | |
705 | (binding_map::to_json): New decl. | |
706 | (binding_cluster::to_json): New decl. | |
707 | (store::to_json): New decl. | |
708 | * supergraph.cc: Include "json.h". | |
709 | (supergraph::to_json): New. | |
710 | (supernode::to_json): New. | |
711 | (superedge::to_json): New. | |
712 | * supergraph.h (supergraph::to_json): New decl. | |
713 | (supernode::to_json): New decl. | |
714 | (superedge::to_json): New decl. | |
715 | * svalue.cc: Include "json.h". | |
716 | (svalue::to_json): New. | |
717 | ||
44135373 GA |
718 | 2020-09-21 David Malcolm <dmalcolm@redhat.com> |
719 | ||
720 | PR analyzer/97130 | |
721 | * region-model-impl-calls.cc (call_details::get_arg_type): New. | |
722 | * region-model.cc (region_model::on_call_pre): Check that the | |
723 | initial arg is a pointer before calling impl_call_memset and | |
724 | impl_call_strlen. | |
725 | * region-model.h (call_details::get_arg_type): New decl. | |
726 | ||
727 | 2020-09-21 David Malcolm <dmalcolm@redhat.com> | |
728 | ||
729 | PR analyzer/93355 | |
730 | * sm-malloc.cc (malloc_state_machine::get_default_state): Look at | |
731 | the base region when considering pointers. Treat pointers to | |
732 | decls as being non-heap. | |
733 | ||
239601c5 GA |
734 | 2020-09-18 David Malcolm <dmalcolm@redhat.com> |
735 | ||
736 | * checker-path.cc (warning_event::get_desc): Handle global state | |
737 | changes. | |
738 | ||
739 | 2020-09-18 David Malcolm <dmalcolm@redhat.com> | |
740 | ||
741 | * sm-malloc.cc (malloc_state_machine::on_stmt): Handle strdup and | |
742 | strndup as being malloc-like allocators. | |
743 | ||
ecde1b0a GA |
744 | 2020-09-16 David Malcolm <dmalcolm@redhat.com> |
745 | ||
746 | * engine.cc (strongly_connected_components::strong_connect): Only | |
747 | consider intraprocedural edges when creating SCCs. | |
748 | (worklist::key_t::cmp): Add comment. Treat call_string | |
749 | differences as more important than differences of program_point | |
750 | within a supernode. | |
751 | ||
752 | 2020-09-16 David Malcolm <dmalcolm@redhat.com> | |
753 | ||
754 | * engine.cc (supernode_cluster::dump_dot): Show the SCC id | |
755 | in the per-supernode clusters in FILENAME.eg.dot output. | |
756 | (exploded_graph_annotator::add_node_annotations): | |
757 | Show the SCC of the supernode in FILENAME.supernode.eg.dot output. | |
758 | * exploded-graph.h (worklist::scc_id): New. | |
759 | (exploded_graph::get_scc_id): New. | |
760 | ||
761 | 2020-09-16 David Malcolm <dmalcolm@redhat.com> | |
762 | ||
763 | * engine.cc (exploded_node::dump_dot): Show STATUS_BULK_MERGED. | |
764 | (exploded_graph::process_worklist): Call | |
765 | maybe_process_run_of_before_supernode_enodes. | |
766 | (exploded_graph::maybe_process_run_of_before_supernode_enodes): | |
767 | New. | |
768 | (exploded_graph_annotator::print_enode): Show STATUS_BULK_MERGED. | |
769 | * exploded-graph.h (enum exploded_node::status): Add | |
770 | STATUS_BULK_MERGED. | |
771 | ||
772 | 2020-09-16 David Malcolm <dmalcolm@redhat.com> | |
773 | ||
774 | * engine.cc | |
775 | (exploded_graph::process_node) <case PK_BEFORE_SUPERNODE>: | |
776 | Simplify by using program_point::get_next. | |
777 | * program-point.cc (program_point::get_next): New. | |
778 | * program-point.h (program_point::get_next): New decl. | |
779 | ||
780 | 2020-09-16 David Malcolm <dmalcolm@redhat.com> | |
781 | ||
782 | * engine.cc (exploded_graph::get_or_create_node): Show the | |
783 | program point when issuing -Wanalyzer-too-complex due to hitting | |
784 | the per-program-point limit. | |
785 | ||
786 | 2020-09-16 David Malcolm <dmalcolm@redhat.com> | |
787 | ||
788 | * region-model.cc (region_model::on_call_pre): Treat getchar as | |
789 | having no side-effects. | |
790 | ||
9f7ab8c5 GA |
791 | 2020-09-15 David Malcolm <dmalcolm@redhat.com> |
792 | ||
793 | PR analyzer/96650 | |
794 | * constraint-manager.cc (merger_fact_visitor::on_fact): Replace | |
795 | assertion that add_constraint succeeded with an assertion that | |
796 | if it fails, -fanalyzer-transitivity is off. | |
797 | ||
50a71cd0 GA |
798 | 2020-09-14 David Malcolm <dmalcolm@redhat.com> |
799 | ||
800 | * analyzer.opt (-param=analyzer-max-constraints=): New param. | |
801 | * constraint-manager.cc | |
802 | (constraint_manager::add_constraint_internal): Silently reject | |
803 | attempts to add constraints when the above limit is reached. | |
804 | ||
805 | 2020-09-14 David Malcolm <dmalcolm@redhat.com> | |
806 | ||
807 | PR analyzer/96653 | |
808 | * constraint-manager.cc | |
809 | (constraint_manager::get_or_add_equiv_class): Don't accumulate | |
810 | transitive closure of all constraints on constants. | |
811 | ||
812 | 2020-09-14 David Malcolm <dmalcolm@redhat.com> | |
813 | ||
814 | PR analyzer/97029 | |
815 | * analyzer.cc (is_setjmp_call_p): Require the initial arg to be a | |
816 | pointer. | |
817 | * region-model.cc (region_model::deref_rvalue): Assert that the | |
818 | svalue is of pointer type. | |
819 | ||
ac35c090 GA |
820 | 2020-09-11 David Malcolm <dmalcolm@redhat.com> |
821 | ||
822 | PR analyzer/96798 | |
823 | * region-model-impl-calls.cc (region_model::impl_call_memcpy): | |
824 | New. | |
825 | (region_model::impl_call_strcpy): New. | |
826 | * region-model.cc (region_model::on_call_pre): Flag unhandled | |
827 | builtins that are non-pure as having unknown side-effects. | |
828 | Implement BUILT_IN_MEMCPY, BUILT_IN_MEMCPY_CHK, BUILT_IN_STRCPY, | |
829 | BUILT_IN_STRCPY_CHK, BUILT_IN_FPRINTF, BUILT_IN_FPRINTF_UNLOCKED, | |
830 | BUILT_IN_PUTC, BUILT_IN_PUTC_UNLOCKED, BUILT_IN_FPUTC, | |
831 | BUILT_IN_FPUTC_UNLOCKED, BUILT_IN_FPUTS, BUILT_IN_FPUTS_UNLOCKED, | |
832 | BUILT_IN_FWRITE, BUILT_IN_FWRITE_UNLOCKED, BUILT_IN_PRINTF, | |
833 | BUILT_IN_PRINTF_UNLOCKED, BUILT_IN_PUTCHAR, | |
834 | BUILT_IN_PUTCHAR_UNLOCKED, BUILT_IN_PUTS, BUILT_IN_PUTS_UNLOCKED, | |
835 | BUILT_IN_VFPRINTF, BUILT_IN_VPRINTF. | |
836 | * region-model.h (region_model::impl_call_memcpy): New decl. | |
837 | (region_model::impl_call_strcpy): New decl. | |
838 | ||
80f86e78 GA |
839 | 2020-09-09 David Malcolm <dmalcolm@redhat.com> |
840 | ||
841 | PR analyzer/94355 | |
842 | * analyzer.opt (Wanalyzer-mismatching-deallocation): New warning. | |
843 | * region-model-impl-calls.cc | |
844 | (region_model::impl_call_operator_new): New. | |
845 | (region_model::impl_call_operator_delete): New. | |
846 | * region-model.cc (region_model::on_call_pre): Detect operator new | |
847 | and operator delete. | |
848 | (region_model::on_call_post): Likewise. | |
849 | (region_model::maybe_update_for_edge): Detect EH edges and call... | |
850 | (region_model::apply_constraints_for_exception): New function. | |
851 | * region-model.h (region_model::impl_call_operator_new): New decl. | |
852 | (region_model::impl_call_operator_delete): New decl. | |
853 | (region_model::apply_constraints_for_exception): New decl. | |
854 | * sm-malloc.cc (enum resource_state): New. | |
855 | (struct allocation_state): New state subclass. | |
856 | (enum wording): New. | |
857 | (struct api): New. | |
858 | (malloc_state_machine::custom_data_t): New typedef. | |
859 | (malloc_state_machine::add_state): New decl. | |
860 | (malloc_state_machine::m_unchecked) | |
861 | (malloc_state_machine::m_nonnull) | |
862 | (malloc_state_machine::m_freed): Delete these states in favor | |
863 | of... | |
864 | (malloc_state_machine::m_malloc) | |
865 | (malloc_state_machine::m_scalar_new) | |
866 | (malloc_state_machine::m_vector_new): ...this new api instances, | |
867 | which own their own versions of these states. | |
868 | (malloc_state_machine::on_allocator_call): New decl. | |
869 | (malloc_state_machine::on_deallocator_call): New decl. | |
870 | (api::api): New ctor. | |
871 | (dyn_cast_allocation_state): New. | |
872 | (as_a_allocation_state): New. | |
873 | (get_rs): New. | |
874 | (unchecked_p): New. | |
875 | (nonnull_p): New. | |
876 | (freed_p): New. | |
877 | (malloc_diagnostic::describe_state_change): Use unchecked_p and | |
878 | nonnull_p. | |
879 | (class mismatching_deallocation): New. | |
880 | (double_free::double_free): Add funcname param for initializing | |
881 | m_funcname. | |
882 | (double_free::emit): Use m_funcname in warning message rather | |
883 | than hardcoding "free". | |
884 | (double_free::describe_state_change): Likewise. Use freed_p. | |
885 | (double_free::describe_call_with_state): Use freed_p. | |
886 | (double_free::describe_final_event): Use m_funcname in message | |
887 | rather than hardcoding "free". | |
888 | (double_free::m_funcname): New field. | |
889 | (possible_null::describe_state_change): Use unchecked_p. | |
890 | (possible_null::describe_return_of_state): Likewise. | |
891 | (use_after_free::use_after_free): Add param for initializing m_api. | |
892 | (use_after_free::emit): Use m_api->m_dealloc_funcname in message | |
893 | rather than hardcoding "free". | |
894 | (use_after_free::describe_state_change): Use freed_p. Change the | |
895 | wording of the message based on the API. | |
896 | (use_after_free::describe_final_event): Use | |
897 | m_api->m_dealloc_funcname in message rather than hardcoding | |
898 | "free". Change the wording of the message based on the API. | |
899 | (use_after_free::m_api): New field. | |
900 | (malloc_leak::describe_state_change): Use unchecked_p. Update | |
901 | for renaming of m_malloc_event to m_alloc_event. | |
902 | (malloc_leak::describe_final_event): Update for renaming of | |
903 | m_malloc_event to m_alloc_event. | |
904 | (malloc_leak::m_malloc_event): Rename... | |
905 | (malloc_leak::m_alloc_event): ...to this. | |
906 | (free_of_non_heap::free_of_non_heap): Add param for initializing | |
907 | m_funcname. | |
908 | (free_of_non_heap::emit): Use m_funcname in message rather than | |
909 | hardcoding "free". | |
910 | (free_of_non_heap::describe_final_event): Likewise. | |
911 | (free_of_non_heap::m_funcname): New field. | |
912 | (allocation_state::dump_to_pp): New. | |
913 | (allocation_state::get_nonnull): New. | |
914 | (malloc_state_machine::malloc_state_machine): Update for changes | |
915 | to state fields and new api fields. | |
916 | (malloc_state_machine::add_state): New. | |
917 | (malloc_state_machine::on_stmt): Move malloc/calloc handling to | |
918 | on_allocator_call and call it, passing in the API pointer. | |
919 | Likewise for free, moving it to on_deallocator_call. Handle calls | |
920 | to operator new and delete in an analogous way. Use unchecked_p | |
921 | when testing for possibly-null-arg and possibly-null-deref, and | |
922 | transition to the non-null for the correct API. Remove redundant | |
923 | node param from call to on_zero_assignment. Use freed_p for | |
924 | use-after-free check, and pass in API. | |
925 | (malloc_state_machine::on_allocator_call): New, based on code in | |
926 | on_stmt. | |
927 | (malloc_state_machine::on_deallocator_call): Likewise. | |
928 | (malloc_state_machine::on_phi): Mark node param with | |
929 | ATTRIBUTE_UNUSED; don't pass it to on_zero_assignment. | |
930 | (malloc_state_machine::on_condition): Mark node param with | |
931 | ATTRIBUTE_UNUSED. Replace on_transition calls with get_state and | |
932 | set_next_state pairs, transitioning to the non-null state for the | |
933 | appropriate API. | |
934 | (malloc_state_machine::can_purge_p): Port to new state approach. | |
935 | (malloc_state_machine::on_zero_assignment): Replace on_transition | |
936 | calls with get_state and set_next_state pairs. Drop redundant | |
937 | node param. | |
938 | * sm.h (state_machine::add_custom_state): New. | |
939 | ||
940 | 2020-09-09 David Malcolm <dmalcolm@redhat.com> | |
941 | ||
942 | * diagnostic-manager.cc | |
943 | (null_assignment_sm_context::warn_for_state): Replace with... | |
944 | (null_assignment_sm_context::warn): ...this. | |
945 | * engine.cc (impl_sm_context::warn_for_state): Replace with... | |
946 | (impl_sm_context::warn): ...this. | |
947 | * sm-file.cc (fileptr_state_machine::on_stmt): Replace | |
948 | warn_for_state and on_transition calls with a get_state | |
949 | test guarding warn and set_next_state calls. | |
950 | * sm-malloc.cc (malloc_state_machine::on_stmt): Likewise. | |
951 | * sm-pattern-test.cc (pattern_test_state_machine::on_condition): | |
952 | Replace warn_for_state call with warn call. | |
953 | * sm-sensitive.cc | |
954 | (sensitive_state_machine::warn_for_any_exposure): Replace | |
955 | warn_for_state call with a get_state test guarding a warn call. | |
956 | * sm-signal.cc (signal_state_machine::on_stmt): Likewise. | |
957 | * sm-taint.cc (taint_state_machine::on_stmt): Replace | |
958 | warn_for_state and on_transition calls with a get_state | |
959 | test guarding warn and set_next_state calls. | |
960 | * sm.h (sm_context::warn_for_state): Replace with... | |
961 | (sm_context::warn): ...this. | |
962 | ||
963 | 2020-09-09 David Malcolm <dmalcolm@redhat.com> | |
964 | ||
965 | * diagnostic-manager.cc | |
966 | (null_assignment_sm_context::null_assignment_sm_context): Add old_state | |
967 | and ext_state params, initializing m_old_state and m_ext_state. | |
968 | (null_assignment_sm_context::on_transition): Split into... | |
969 | (null_assignment_sm_context::get_state): ...this new vfunc | |
970 | implementation and... | |
971 | (null_assignment_sm_context::set_next_state): ...this new vfunc | |
972 | implementation. | |
973 | (null_assignment_sm_context::m_old_state): New field. | |
974 | (null_assignment_sm_context::m_ext_state): New field. | |
975 | (diagnostic_manager::add_events_for_eedge): Pass in old state and | |
976 | ext_state when creating sm_ctxt. | |
977 | * engine.cc (impl_sm_context::on_transition): Split into... | |
978 | (impl_sm_context::get_state): ...this new vfunc | |
979 | implementation and... | |
980 | (impl_sm_context::set_next_state): ...this new vfunc | |
981 | implementation. | |
982 | * sm.h (sm_context::get_state): New pure virtual function. | |
983 | (sm_context::set_next_state): Likewise. | |
984 | (sm_context::on_transition): Convert from a pure virtual function | |
985 | to a regular function implemented in terms of get_state and | |
986 | set_next_state. | |
987 | ||
988 | 2020-09-09 David Malcolm <dmalcolm@redhat.com> | |
989 | ||
990 | * checker-path.cc (state_change_event::get_desc): Update | |
991 | state_machine::get_state_name calls to state::get_name. | |
992 | (warning_event::get_desc): Likewise. | |
993 | * diagnostic-manager.cc | |
994 | (null_assignment_sm_context::on_transition): Update comparison | |
995 | against 0 with comparison with m_sm.get_start_state. | |
996 | (diagnostic_manager::prune_for_sm_diagnostic): Update | |
997 | state_machine::get_state_name calls to state::get_name. | |
998 | * engine.cc (impl_sm_context::on_transition): Likewise. | |
999 | (exploded_node::get_dot_fillcolor): Use get_id when summing | |
1000 | the sm states. | |
1001 | * program-state.cc (sm_state_map::sm_state_map): Don't hardcode | |
1002 | 0 as the start state when initializing m_global_state. | |
1003 | (sm_state_map::print): Use dump_to_pp rather than get_state_name | |
1004 | when dumping states. | |
1005 | (sm_state_map::is_empty_p): Don't hardcode 0 as the start state | |
1006 | when examining m_global_state. | |
1007 | (sm_state_map::hash): Use get_id when hashing states. | |
1008 | (selftest::test_sm_state_map): Use state objects rather than | |
1009 | arbitrary hardcoded integers. | |
1010 | (selftest::test_program_state_merging): Likewise. | |
1011 | (selftest::test_program_state_merging_2): Likewise. | |
1012 | * sm-file.cc (fileptr_state_machine::m_start): Move to base class. | |
1013 | (file_diagnostic::describe_state_change): Use get_start_state. | |
1014 | (fileptr_state_machine::fileptr_state_machine): Drop m_start | |
1015 | initialization. | |
1016 | * sm-malloc.cc (malloc_state_machine::m_start): Move to base | |
1017 | class. | |
1018 | (malloc_diagnostic::describe_state_change): Use get_start_state. | |
1019 | (possible_null::describe_state_change): Likewise. | |
1020 | (malloc_state_machine::malloc_state_machine): Drop m_start | |
1021 | initialization. | |
1022 | * sm-pattern-test.cc (pattern_test_state_machine::m_start): Move | |
1023 | to base class. | |
1024 | (pattern_test_state_machine::pattern_test_state_machine): Drop | |
1025 | m_start initialization. | |
1026 | * sm-sensitive.cc (sensitive_state_machine::m_start): Move to base | |
1027 | class. | |
1028 | (sensitive_state_machine::sensitive_state_machine): Drop m_start | |
1029 | initialization. | |
1030 | * sm-signal.cc (signal_state_machine::m_start): Move to base | |
1031 | class. | |
1032 | (signal_state_machine::signal_state_machine): Drop m_start | |
1033 | initialization. | |
1034 | * sm-taint.cc (taint_state_machine::m_start): Move to base class. | |
1035 | (taint_state_machine::taint_state_machine): Drop m_start | |
1036 | initialization. | |
1037 | * sm.cc (state_machine::state::dump_to_pp): New. | |
1038 | (state_machine::state_machine): Move here from sm.h. Initialize | |
1039 | m_next_state_id and m_start. | |
1040 | (state_machine::add_state): Reimplement in terms of state objects. | |
1041 | (state_machine::get_state_name): Delete. | |
1042 | (state_machine::get_state_by_name): Reimplement in terms of state | |
1043 | objects. Make const. | |
1044 | (state_machine::validate): Delete. | |
1045 | (state_machine::dump_to_pp): Reimplement in terms of state | |
1046 | objects. | |
1047 | * sm.h (state_machine::state): New class. | |
1048 | (state_machine::state_t): Convert typedef from "unsigned" to | |
1049 | "const state_machine::state *". | |
1050 | (state_machine::state_machine): Move to sm.cc. | |
1051 | (state_machine::get_default_state): Use m_start rather than | |
1052 | hardcoding 0. | |
1053 | (state_machine::get_state_name): Delete. | |
1054 | (state_machine::get_state_by_name): Make const. | |
1055 | (state_machine::get_start_state): New accessor. | |
1056 | (state_machine::alloc_state_id): New. | |
1057 | (state_machine::m_state_names): Drop in favor of... | |
1058 | (state_machine::m_states): New field | |
1059 | (state_machine::m_start): New field | |
1060 | (start_start_p): Delete. | |
1061 | ||
31a05046 GA |
1062 | 2020-09-08 David Malcolm <dmalcolm@redhat.com> |
1063 | ||
1064 | PR analyzer/96949 | |
1065 | * store.cc (binding_map::apply_ctor_val_to_range): Add | |
1066 | error-handling for the cases where we have symbolic offsets. | |
1067 | ||
1068 | 2020-09-08 David Malcolm <dmalcolm@redhat.com> | |
1069 | ||
1070 | PR analyzer/96950 | |
1071 | * store.cc (binding_map::apply_ctor_to_region): Handle RANGE_EXPR | |
1072 | where min_index == max_index. | |
1073 | (binding_map::apply_ctor_val_to_range): Replace assertion that we | |
1074 | don't have a CONSTRUCTOR value with error-handling. | |
1075 | ||
1076 | 2020-09-08 David Malcolm <dmalcolm@redhat.com> | |
1077 | ||
1078 | PR analyzer/96962 | |
1079 | * region-model.cc (region_model::on_call_pre): Fix guard on switch | |
1080 | on built-ins to only consider BUILT_IN_NORMAL, rather than other | |
1081 | kinds of build-ins. | |
1082 | ||
e1a4a8a0 GA |
1083 | 2020-09-01 David Malcolm <dmalcolm@redhat.com> |
1084 | ||
1085 | PR analyzer/96792 | |
1086 | * region-model.cc (region_model::deref_rvalue): Add the constraint | |
1087 | that PTR_SVAL is non-NULL. | |
1088 | ||
13e4ba28 GA |
1089 | 2020-08-31 David Malcolm <dmalcolm@redhat.com> |
1090 | ||
1091 | PR analyzer/96798 | |
1092 | * region-model.cc (region_model::on_call_pre): Handle | |
1093 | BUILT_IN_MEMSET_CHK. | |
1094 | ||
1095 | 2020-08-31 David Malcolm <dmalcolm@redhat.com> | |
1096 | ||
1097 | * region-model.cc (region_model::on_call_pre): Gather handling of | |
1098 | builtins and of internal fns into switch statements. Handle | |
1099 | "alloca" and BUILT_IN_ALLOCA_WITH_ALIGN. | |
1100 | ||
1101 | 2020-08-31 David Malcolm <dmalcolm@redhat.com> | |
1102 | ||
1103 | PR analyzer/96860 | |
1104 | * region.cc (decl_region::get_svalue_for_constructor): Support | |
1105 | apply_ctor_to_region failing. | |
1106 | * store.cc (binding_map::apply_ctor_to_region): Add failure | |
1107 | handling. | |
1108 | (binding_map::apply_ctor_val_to_range): Likewise. | |
1109 | (binding_map::apply_ctor_pair_to_child_region): Likewise. Replace | |
1110 | assertion that child_base_offset is not symbolic with error | |
1111 | handling. | |
1112 | * store.h (binding_map::apply_ctor_to_region): Convert return type | |
1113 | from void to bool. | |
1114 | (binding_map::apply_ctor_val_to_range): Likewise. | |
1115 | (binding_map::apply_ctor_pair_to_child_region): Likewise. | |
1116 | ||
1117 | 2020-08-31 David Malcolm <dmalcolm@redhat.com> | |
1118 | ||
1119 | PR analyzer/96763 | |
1120 | * store.cc (binding_map::apply_ctor_to_region): Handle RANGE_EXPR | |
1121 | by calling a new binding_map::apply_ctor_val_to_range subroutine. | |
1122 | Split out the existing non-CONSTRUCTOR-handling code to a new | |
1123 | apply_ctor_pair_to_child_region subroutine. | |
1124 | (binding_map::apply_ctor_val_to_range): New. | |
1125 | (binding_map::apply_ctor_pair_to_child_region): New, split out | |
1126 | from binding_map::apply_ctor_to_region as noted above. | |
1127 | * store.h (binding_map::apply_ctor_val_to_range): New decl. | |
1128 | (binding_map::apply_ctor_pair_to_child_region): New decl. | |
1129 | ||
1130 | 2020-08-31 David Malcolm <dmalcolm@redhat.com> | |
1131 | ||
1132 | PR analyzer/96764 | |
1133 | * region-model-manager.cc | |
1134 | (region_model_manager::maybe_fold_unaryop): Handle VIEW_CONVERT_EXPR. | |
1135 | (region_model_manager::get_or_create_cast): Move logic for | |
1136 | real->integer casting to... | |
1137 | (get_code_for_cast): ...this new function, and add logic for | |
1138 | real->non-integer casts. | |
1139 | (region_model_manager::maybe_fold_sub_svalue): Handle | |
1140 | VIEW_CONVERT_EXPR. | |
1141 | * region-model.cc | |
1142 | (region_model::add_any_constraints_from_gassign): Likewise. | |
1143 | * svalue.cc (svalue::maybe_undo_cast): Likewise. | |
1144 | (unaryop_svalue::dump_to_pp): Likewise. | |
1145 | ||
57ea0894 GA |
1146 | 2020-08-26 David Malcolm <dmalcolm@redhat.com> |
1147 | ||
1148 | PR analyzer/94858 | |
1149 | * region-model-manager.cc | |
1150 | (region_model_manager::get_or_create_widening_svalue): Assert that | |
1151 | neither of the inputs are themselves widenings. | |
1152 | * store.cc (store::eval_alias_1): The initial value of a pointer | |
1153 | can't point to a region that was allocated on the heap after the | |
1154 | beginning of the path. A widened pointer value can't alias anything | |
1155 | that the initial pointer value can't alias. | |
1156 | * svalue.cc (svalue::can_merge_p): Merge BINOP (X, OP, CST) with X | |
1157 | to a widening svalue. Merge | |
1158 | BINOP(WIDENING(BASE, BINOP(BASE, X)), X) and BINOP(BASE, X) to | |
1159 | to the LHS of the first BINOP. | |
1160 | ||
1161 | 2020-08-26 David Malcolm <dmalcolm@redhat.com> | |
1162 | ||
1163 | PR analyzer/96777 | |
1164 | * region-model.h (class compound_svalue): Document that all keys | |
1165 | must be concrete. | |
1166 | (compound_svalue::compound_svalue): Move definition to svalue.cc. | |
1167 | * store.cc (binding_map::apply_ctor_to_region): Handle | |
1168 | initializers for trailing arrays with incomplete size. | |
1169 | * svalue.cc (compound_svalue::compound_svalue): Move definition | |
1170 | here from region-model.h. Add assertion that all keys are | |
1171 | concrete. | |
1172 | ||
e769f970 GA |
1173 | 2020-08-22 David Malcolm <dmalcolm@redhat.com> |
1174 | ||
1175 | PR analyzer/94851 | |
1176 | * region-model-manager.cc | |
1177 | (region_model_manager::maybe_fold_binop): Fold bitwise "& 0" to 0. | |
1178 | ||
1179 | 2020-08-22 David Malcolm <dmalcolm@redhat.com> | |
1180 | ||
1181 | * store.cc (store::eval_alias): Make const. Split out 2nd half | |
1182 | into store::eval_alias_1 and call it twice for symmetry, avoiding | |
1183 | test duplication. | |
1184 | (store::eval_alias_1): New function, split out from the above. | |
1185 | * store.h (store::eval_alias): Make const. | |
1186 | (store::eval_alias_1): New decl. | |
1187 | ||
1188 | 2020-08-22 David Malcolm <dmalcolm@redhat.com> | |
1189 | ||
1190 | * region-model.cc (region_model::push_frame): Bind the default | |
1191 | SSA name for each parm if it exists, falling back to the parm | |
1192 | itself otherwise, rather than doing both. | |
1193 | ||
5b9a3d2a GA |
1194 | 2020-08-20 David Malcolm <dmalcolm@redhat.com> |
1195 | ||
1196 | PR analyzer/96723 | |
1197 | * region-model-manager.cc | |
1198 | (region_model_manager::get_field_region): Assert that field is a | |
1199 | FIELD_DECL. | |
1200 | * region.cc (region::get_subregions_for_binding): In | |
1201 | union-handling, filter the TYPE_FIELDS traversal to just FIELD_DECLs. | |
1202 | ||
1203 | 2020-08-20 David Malcolm <dmalcolm@redhat.com> | |
1204 | ||
1205 | PR analyzer/96713 | |
1206 | * region-model.cc (region_model::get_gassign_result): For | |
1207 | comparisons, only use eval_condition when the lhs has boolean | |
1208 | type, and use get_or_create_constant_svalue on the boolean | |
1209 | constants directly rather than via get_rvalue. | |
1210 | ||
04e23a40 GA |
1211 | 2020-08-19 David Malcolm <dmalcolm@redhat.com> |
1212 | ||
1213 | PR analyzer/96643 | |
1214 | * region-model.cc (region_model::deref_rvalue): Rather than | |
1215 | attempting to handle all svalue kinds in the switch, only cover | |
1216 | the special cases, and move symbolic-region handling to after | |
1217 | the switch, thus implicitly handling the missing case SK_COMPOUND. | |
1218 | ||
1219 | 2020-08-19 David Malcolm <dmalcolm@redhat.com> | |
1220 | ||
1221 | PR analyzer/96705 | |
1222 | * region-model-manager.cc | |
1223 | (region_model_manager::maybe_fold_binop): Check that we have an | |
1224 | integral type before calling build_int_cst. | |
1225 | ||
1226 | 2020-08-19 David Malcolm <dmalcolm@redhat.com> | |
1227 | ||
1228 | PR analyzer/96699 | |
1229 | * region-model-manager.cc | |
1230 | (region_model_manager::get_or_create_cast): Use FIX_TRUNC_EXPR for | |
1231 | casting from REAL_TYPE to INTEGER_TYPE. | |
1232 | ||
1233 | 2020-08-19 David Malcolm <dmalcolm@redhat.com> | |
1234 | ||
1235 | PR analyzer/96651 | |
1236 | * region-model.cc (region_model::called_from_main_p): New. | |
1237 | (region_model::get_store_value): Move handling for globals into... | |
1238 | (region_model::get_initial_value_for_global): ...this new | |
1239 | function, and add logic for extracting values from decl | |
1240 | initializers. | |
1241 | * region-model.h (decl_region::get_svalue_for_constructor): New | |
1242 | decl. | |
1243 | (decl_region::get_svalue_for_initializer): New decl. | |
1244 | (region_model::called_from_main_p): New decl. | |
1245 | (region_model::get_initial_value_for_global): New. | |
1246 | * region.cc (decl_region::maybe_get_constant_value): Move logic | |
1247 | for getting an svalue from a CONSTRUCTOR node to... | |
1248 | (decl_region::get_svalue_for_constructor): ...this new function. | |
1249 | (decl_region::get_svalue_for_initializer): New. | |
1250 | * store.cc (get_svalue_for_ctor_val): Rewrite in terms of | |
1251 | region_model::get_rvalue. | |
1252 | * store.h (binding_cluster::get_map): New accessor. | |
1253 | ||
1254 | 2020-08-19 David Malcolm <dmalcolm@redhat.com> | |
1255 | ||
1256 | PR analyzer/96648 | |
1257 | * region.cc (get_field_at_bit_offset): Gracefully handle negative | |
1258 | values for bit_offset. | |
1259 | ||
5c265693 GA |
1260 | 2020-08-18 David Malcolm <dmalcolm@redhat.com> |
1261 | ||
1262 | * region-model.cc (region_model::get_rvalue_1): Fix name of local. | |
1263 | ||
1264 | 2020-08-18 David Malcolm <dmalcolm@redhat.com> | |
1265 | ||
1266 | PR analyzer/96641 | |
1267 | * region-model.cc (region_model::get_rvalue_1): Handle | |
1268 | unrecognized tree codes by returning "UNKNOWN. | |
1269 | ||
1270 | 2020-08-18 David Malcolm <dmalcolm@redhat.com> | |
1271 | ||
1272 | PR analyzer/96640 | |
1273 | * region-model.cc (region_model::get_gassign_result): Handle various | |
1274 | VEC_* tree codes by returning UNKNOWN. | |
1275 | (region_model::on_assignment): Handle unrecognized tree codes by | |
1276 | setting lhs to an unknown value, rather than issuing a "sorry" and | |
1277 | asserting. | |
1278 | ||
deee2322 GA |
1279 | 2020-08-17 David Malcolm <dmalcolm@redhat.com> |
1280 | ||
1281 | PR analyzer/96644 | |
1282 | * region-model-manager.cc (get_region_for_unexpected_tree_code): | |
1283 | Handle ctxt being NULL. | |
1284 | ||
1285 | 2020-08-17 David Malcolm <dmalcolm@redhat.com> | |
1286 | ||
1287 | PR analyzer/96639 | |
1288 | * region.cc (region::get_subregions_for_binding): Check for "type" | |
1289 | being NULL. | |
1290 | ||
1291 | 2020-08-17 David Malcolm <dmalcolm@redhat.com> | |
1292 | ||
1293 | PR analyzer/96642 | |
1294 | * store.cc (get_svalue_for_ctor_val): New. | |
1295 | (binding_map::apply_ctor_to_region): Call it. | |
1296 | ||
661ee09b GA |
1297 | 2020-08-14 David Malcolm <dmalcolm@redhat.com> |
1298 | ||
1299 | PR testsuite/96609 | |
1300 | PR analyzer/96616 | |
1301 | * region-model.cc (region_model::get_store_value): Call | |
1302 | maybe_get_constant_value on decl_regions first. | |
1303 | * region-model.h (decl_region::maybe_get_constant_value): New decl. | |
1304 | * region.cc (decl_region::get_stack_depth): Likewise. | |
1305 | (decl_region::maybe_get_constant_value): New. | |
1306 | * store.cc (get_subregion_within_ctor): New. | |
1307 | (binding_map::apply_ctor_to_region): New. | |
1308 | * store.h (binding_map::apply_ctor_to_region): New decl. | |
1309 | ||
1310 | 2020-08-14 David Malcolm <dmalcolm@redhat.com> | |
1311 | ||
1312 | PR analyzer/96611 | |
1313 | * store.cc (store::mark_as_escaped): Reject attempts to | |
1314 | get a cluster for an unknown pointer. | |
1315 | ||
b3cb5606 GA |
1316 | 2020-08-13 David Malcolm <dmalcolm@redhat.com> |
1317 | ||
5afd1882 ML |
1318 | PR analyzer/93032 |
1319 | PR analyzer/93938 | |
1320 | PR analyzer/94011 | |
1321 | PR analyzer/94099 | |
1322 | PR analyzer/94399 | |
1323 | PR analyzer/94458 | |
1324 | PR analyzer/94503 | |
1325 | PR analyzer/94640 | |
1326 | PR analyzer/94688 | |
1327 | PR analyzer/94689 | |
1328 | PR analyzer/94839 | |
1329 | PR analyzer/95026 | |
1330 | PR analyzer/95042 | |
1331 | PR analyzer/95240 | |
b3cb5606 GA |
1332 | * analyzer-logging.cc: Ignore "-Wformat-diag". |
1333 | (logger::enter_scope): Use inc_indent in both overloads. | |
1334 | (logger::exit_scope): Use dec_indent. | |
1335 | * analyzer-logging.h (logger::inc_indent): New. | |
1336 | (logger::dec_indent): New. | |
1337 | * analyzer-selftests.cc (run_analyzer_selftests): Call | |
1338 | analyzer_store_cc_tests. | |
1339 | * analyzer-selftests.h (analyzer_store_cc_tests): New decl. | |
1340 | * analyzer.cc (get_stmt_location): New function. | |
1341 | * analyzer.h (class initial_svalue): New forward decl. | |
1342 | (class unaryop_svalue): New forward decl. | |
1343 | (class binop_svalue): New forward decl. | |
1344 | (class sub_svalue): New forward decl. | |
1345 | (class unmergeable_svalue): New forward decl. | |
1346 | (class placeholder_svalue): New forward decl. | |
1347 | (class widening_svalue): New forward decl. | |
1348 | (class compound_svalue): New forward decl. | |
1349 | (class conjured_svalue): New forward decl. | |
1350 | (svalue_set): New typedef. | |
1351 | (class map_region): Delete. | |
1352 | (class array_region): Delete. | |
1353 | (class frame_region): New forward decl. | |
1354 | (class function_region): New forward decl. | |
1355 | (class label_region): New forward decl. | |
1356 | (class decl_region): New forward decl. | |
1357 | (class element_region): New forward decl. | |
1358 | (class offset_region): New forward decl. | |
1359 | (class cast_region): New forward decl. | |
1360 | (class field_region): New forward decl. | |
1361 | (class string_region): New forward decl. | |
1362 | (class region_model_manager): New forward decl. | |
1363 | (class store_manager): New forward decl. | |
1364 | (class store): New forward decl. | |
1365 | (class call_details): New forward decl. | |
1366 | (struct svalue_id_merger_mapping): Delete. | |
1367 | (struct canonicalization): Delete. | |
1368 | (class function_point): New forward decl. | |
1369 | (class engine): New forward decl. | |
1370 | (dump_tree): New function decl. | |
1371 | (print_quoted_type): New function decl. | |
1372 | (readability_comparator): New function decl. | |
1373 | (tree_cmp): New function decl. | |
1374 | (class path_var): Move here from region-model.h | |
1375 | (bit_offset_t, bit_size_t, byte_size_t): New typedefs. | |
1376 | (class region_offset): New class. | |
1377 | (get_stmt_location): New decl. | |
1378 | (struct member_function_hash_traits): New struct. | |
1379 | (class consolidation_map): New class. | |
1380 | Ignore "-Wformat-diag". | |
1381 | * analyzer.opt (-param=analyzer-max-svalue-depth=): New param. | |
1382 | (-param=analyzer-max-enodes-for-full-dump=): New param. | |
1383 | * call-string.cc: Ignore -Wformat-diag. | |
1384 | * checker-path.cc: Move includes of "analyzer/call-string.h" and | |
1385 | "analyzer/program-point.h" to before "analyzer/region-model.h", | |
1386 | and also include "analyzer/store.h" before it. | |
1387 | (state_change_event::state_change_event): Replace "tree var" param | |
1388 | with "const svalue *sval". Convert "origin" param from tree to | |
1389 | "const svalue *". | |
1390 | (state_change_event::get_desc): Call get_representative_tree to | |
1391 | convert the var and origin from const svalue * to tree. Use | |
1392 | svalue::get_desc rather than %qE when describing state changes. | |
1393 | (checker_path::add_final_event): Use get_stmt_location. | |
1394 | * checker-path.h (state_change_event::state_change_event): Port | |
1395 | from tree to const svalue *. | |
1396 | (state_change_event::get_lvalue): Delete. | |
1397 | (state_change_event::get_dest_function): New. | |
1398 | (state_change_event::m_var): Replace with... | |
1399 | (state_change_event::m_sval): ...this. | |
1400 | (state_change_event::m_origin): Convert from tree to | |
1401 | const svalue *. | |
1402 | * constraint-manager.cc: Include "analyzer/call-string.h", | |
1403 | "analyzer/program-point.h", and "analyzer/store.h" before | |
1404 | "analyzer/region-model.h". | |
1405 | (struct bound, struct range): Move to constraint-manager.h. | |
1406 | (compare_constants): New function. | |
1407 | (range::dump): Rename to... | |
1408 | (range::dump_to_pp): ...this. Support NULL constants. | |
1409 | (range::dump): Reintroduce for dumping to stderr. | |
1410 | (range::constrained_to_single_element): Return result, rather than | |
1411 | writing to *OUT. | |
1412 | (range::eval_condition): New. | |
1413 | (range::below_lower_bound): New. | |
1414 | (range::above_upper_bound): New. | |
1415 | (equiv_class::equiv_class): Port from svalue_id to const svalue *. | |
1416 | (equiv_class::print): Likewise. | |
1417 | (equiv_class::hash): Likewise. | |
1418 | (equiv_class::operator==): Port from svalue_id to const svalue *. | |
1419 | (equiv_class::add): Port from svalue_id to const svalue *. Drop | |
1420 | "cm" param. | |
1421 | (equiv_class::del): Port from svalue_id to const svalue *. | |
1422 | (equiv_class::get_representative): Likewise. | |
1423 | (equiv_class::remap_svalue_ids): Delete. | |
1424 | (svalue_id_cmp_by_id): Rename to... | |
1425 | (svalue_cmp_by_ptr): ...this, porting from svalue_id to | |
1426 | const svalue *. | |
1427 | (equiv_class::canonicalize): Update qsort comparator. | |
1428 | (constraint::implied_by): New. | |
1429 | (constraint_manager::constraint_manager): Copy m_mgr in copy ctor. | |
1430 | (constraint_manager::dump_to_pp): Add "multiline" param | |
1431 | (constraint_manager::dump): Pass "true" for "multiline". | |
1432 | (constraint_manager::add_constraint): Port from svalue_id to | |
1433 | const svalue *. Split out second part into... | |
1434 | (constraint_manager::add_unknown_constraint): ...this new | |
1435 | function. Remove self-constraints when merging equivalence | |
1436 | classes. | |
1437 | (constraint_manager::add_constraint_internal): Remove constraints | |
1438 | that would be implied by the new constraint. Port from svalue_id | |
1439 | to const svalue *. | |
1440 | (constraint_manager::get_equiv_class_by_sid): Rename to... | |
1441 | (constraint_manager::get_equiv_class_by_svalue): ...this, porting | |
1442 | from svalue_id to const svalue *. | |
1443 | (constraint_manager::get_or_add_equiv_class): Port from svalue_id | |
1444 | to const svalue *. | |
1445 | (constraint_manager::eval_condition): Make const. Call | |
1446 | compare_constants and return early if it provides a known result. | |
1447 | (constraint_manager::get_ec_bounds): New. | |
1448 | (constraint_manager::eval_condition): New overloads. Make | |
1449 | existing one const, and use compare_constants. | |
1450 | (constraint_manager::purge): Convert "p" param to a template | |
1451 | rather that an abstract base class. Port from svalue_id to | |
1452 | const svalue *. | |
1453 | (class dead_svalue_purger): New class. | |
1454 | (constraint_manager::remap_svalue_ids): Delete. | |
1455 | (constraint_manager::on_liveness_change): New. | |
1456 | (equiv_class_cmp): Port from svalue_id to const svalue *. | |
1457 | (constraint_manager::canonicalize): Likewise. Combine with | |
1458 | purging of redundant equivalence classes and constraints. | |
1459 | (class cleaned_constraint_manager): Delete. | |
1460 | (class merger_fact_visitor): Make "m_cm_b" const. Add "m_merger" | |
1461 | field. | |
1462 | (merger_fact_visitor::fact): Port from svalue_id to const svalue *. | |
1463 | Add special case for widening. | |
1464 | (constraint_manager::merge): Port from svalue_id to const svalue *. | |
1465 | (constraint_manager::clean_merger_input): Delete. | |
1466 | (constraint_manager::for_each_fact): Port from svalue_id to | |
1467 | const svalue *. | |
1468 | (constraint_manager::validate): Likewise. | |
1469 | (selftest::test_constraint_conditions): Provide a | |
1470 | region_model_manager when creating region_model instances. | |
1471 | Add test for self-equality not creating equivalence classes. | |
1472 | (selftest::test_transitivity): Provide a region_model_manager when | |
1473 | creating region_model instances. Verify that EC-merging happens | |
1474 | when constraints are implied. | |
1475 | (selftest::test_constant_comparisons): Provide a | |
1476 | region_model_manager when creating region_model instances. | |
1477 | (selftest::test_constraint_impl): Likewise. Remove over-specified | |
1478 | assertions. | |
1479 | (selftest::test_equality): Provide a region_model_manager when | |
1480 | creating region_model instances. | |
1481 | (selftest::test_many_constants): Likewise. Provide a | |
1482 | program_point when testing merging. | |
1483 | (selftest::run_constraint_manager_tests): Move call to | |
1484 | test_constant_comparisons to outside the transitivity guard. | |
1485 | * constraint-manager.h (struct bound): Move here from | |
1486 | constraint-manager.cc. | |
1487 | (struct range): Likewise. | |
1488 | (struct::eval_condition): New decl. | |
1489 | (struct::below_lower_bound): New decl. | |
1490 | (struct::above_upper_bound): New decl. | |
1491 | (equiv_class::add): Port from svalue_id to const svalue *. | |
1492 | (equiv_class::del): Likewise. | |
1493 | (equiv_class::get_representative): Likewise. | |
1494 | (equiv_class::remap_svalue_ids): Drop. | |
1495 | (equiv_class::m_cst_sid): Convert to.. | |
1496 | (equiv_class::m_cst_sval): ...this. | |
1497 | (equiv_class::m_vars): Port from svalue_id to const svalue *. | |
1498 | (constraint::bool implied_by): New decl. | |
1499 | (fact_visitor::on_fact): Port from svalue_id to const svalue *. | |
1500 | (constraint_manager::constraint_manager): Add mgr param. | |
1501 | (constraint_manager::clone): Delete. | |
1502 | (constraint_manager::maybe_get_constant): Delete. | |
1503 | (constraint_manager::get_sid_for_constant): Delete. | |
1504 | (constraint_manager::get_num_svalues): Delete. | |
1505 | (constraint_manager::dump_to_pp): Add "multiline" param. | |
1506 | (constraint_manager::get_equiv_class): Port from svalue_id to | |
1507 | const svalue *. | |
1508 | (constraint_manager::add_constraint): Likewise. | |
1509 | (constraint_manager::get_equiv_class_by_sid): Rename to... | |
1510 | (constraint_manager::get_equiv_class_by_svalue): ...this, porting | |
1511 | from svalue_id to const svalue *. | |
1512 | (constraint_manager::add_unknown_constraint): New decl. | |
1513 | (constraint_manager::get_or_add_equiv_class): Port from svalue_id | |
1514 | to const svalue *. | |
1515 | (constraint_manager::eval_condition): Likewise. Add overloads. | |
1516 | (constraint_manager::get_ec_bounds): New decl. | |
1517 | (constraint_manager::purge): Convert to template. | |
1518 | (constraint_manager::remap_svalue_ids): Delete. | |
1519 | (constraint_manager::on_liveness_change): New decl. | |
1520 | (constraint_manager::canonicalize): Drop param. | |
1521 | (constraint_manager::clean_merger_input): Delete. | |
1522 | (constraint_manager::m_mgr): New field. | |
1523 | * diagnostic-manager.cc: Move includes of | |
1524 | "analyzer/call-string.h" and "analyzer/program-point.h" to before | |
1525 | "analyzer/region-model.h", and also include "analyzer/store.h" | |
1526 | before it. | |
1527 | (saved_diagnostic::saved_diagnostic): Add "sval" param. | |
1528 | (diagnostic_manager::diagnostic_manager): Add engine param. | |
1529 | (diagnostic_manager::add_diagnostic): Add "sval" param, passing it | |
1530 | to saved_diagnostic ctor. Update overload to pass NULL for it. | |
1531 | (dedupe_winners::dedupe_winners): Add engine param. | |
1532 | (dedupe_winners::add): Add "eg" param. Pass m_engine to | |
1533 | feasible_p. | |
1534 | (dedupe_winner::m_engine): New field. | |
1535 | (diagnostic_manager::emit_saved_diagnostics): Pass engine to | |
1536 | dedupe_winners. Pass &eg when adding candidates. Pass svalue | |
1537 | rather than tree to prune_path. Use get_stmt_location to get | |
1538 | primary location of diagnostic. | |
1539 | (diagnostic_manager::emit_saved_diagnostic): Likewise. | |
1540 | (get_any_origin): Drop. | |
1541 | (state_change_event_creator::on_global_state_change): Pass NULL | |
1542 | const svalue * rather than NULL_TREE trees to state_change_event | |
1543 | ctor. | |
1544 | (state_change_event_creator::on_state_change): Port from tree and | |
1545 | svalue_id to const svalue *. | |
1546 | (for_each_state_change): Port from svalue_id to const svalue *. | |
1547 | (struct null_assignment_sm_context): New. | |
1548 | (diagnostic_manager::add_events_for_eedge): Add state change | |
1549 | events for assignment to NULL. | |
1550 | (diagnostic_manager::prune_path): Update param from tree to | |
1551 | const svalue *. | |
1552 | (diagnostic_manager::prune_for_sm_diagnostic): Port from tracking | |
1553 | by tree to by const svalue *. | |
1554 | * diagnostic-manager.h (saved_diagnostic::saved_diagnostic): Add sval | |
1555 | param. | |
1556 | (saved_diagnostic::m_sval): New field. | |
1557 | (diagnostic_manager::diagnostic_manager): Add engine param. | |
1558 | (diagnostic_manager::get_engine): New. | |
1559 | (diagnostic_manager::add_diagnostic): Add "sval" param. | |
1560 | (diagnostic_manager::prune_path): Likewise. | |
1561 | (diagnostic_manager::prune_for_sm_diagnostic): New overload. | |
1562 | (diagnostic_manager::m_eng): New field. | |
1563 | * engine.cc: Move includes of "analyzer/call-string.h" and | |
1564 | "analyzer/program-point.h" to before "analyzer/region-model.h", | |
1565 | and also include "analyzer/store.h" before it. | |
1566 | (impl_region_model_context::impl_region_model_context): Update for | |
1567 | removal of m_change field. | |
1568 | (impl_region_model_context::remap_svalue_ids): Delete. | |
1569 | (impl_region_model_context::on_svalue_leak): New. | |
1570 | (impl_region_model_context::on_svalue_purge): Delete. | |
1571 | (impl_region_model_context::on_liveness_change): New. | |
1572 | (impl_region_model_context::on_unknown_change): Update param | |
1573 | from svalue_id to const svalue *. Add is_mutable param. | |
1574 | (setjmp_svalue::compare_fields): Delete. | |
1575 | (setjmp_svalue::accept): New. | |
1576 | (setjmp_svalue::add_to_hash): Delete. | |
1577 | (setjmp_svalue::dump_to_pp): New. | |
1578 | (setjmp_svalue::print_details): Delete. | |
1579 | (impl_sm_context::impl_sm_context): Drop "change" param. | |
1580 | (impl_sm_context::get_fndecl_for_call): Drop "m_change". | |
1581 | (impl_sm_context::on_transition): Drop ATTRIBUTE_UNUSED from | |
1582 | "stmt" param. Drop m_change. Port from svalue_id to | |
1583 | const svalue *. | |
1584 | (impl_sm_context::warn_for_state): Drop m_change. Port from | |
1585 | svalue_id to const svalue *. | |
1586 | (impl_sm_context::get_readable_tree): Rename to... | |
1587 | (impl_sm_context::get_diagnostic_tree): ...this. Port from | |
1588 | svalue_id to const svalue *. | |
1589 | (impl_sm_context::is_zero_assignment): New. | |
1590 | (impl_sm_context::m_change): Delete field. | |
1591 | (leak_stmt_finder::find_stmt): Handle m_var being NULL. | |
1592 | (readability): Increase penalty for MEM_REF. For SSA_NAMEs, | |
1593 | slightly favor the underlying var over the SSA name. Heavily | |
1594 | penalize temporaries. Handle RESULT_DECL. | |
1595 | (readability_comparator): Make non-static. Consider stack depths. | |
1596 | (impl_region_model_context::on_state_leak): Convert from svalue_id | |
1597 | to const svalue *, updating for region_model changes. Use | |
1598 | id_equal. | |
1599 | (impl_region_model_context::on_inherited_svalue): Delete. | |
1600 | (impl_region_model_context::on_cast): Delete. | |
1601 | (impl_region_model_context::on_condition): Drop m_change. | |
1602 | (impl_region_model_context::on_phi): Likewise. | |
1603 | (impl_region_model_context::on_unexpected_tree_code): Handle t | |
1604 | being NULL. | |
1605 | (point_and_state::validate): Update stack checking for | |
1606 | region_model changes. | |
1607 | (eg_traits::dump_args_t::show_enode_details_p): New. | |
1608 | (exploded_node::exploded_node): Initialize m_num_processed_stmts. | |
1609 | (exploded_node::get_processed_stmt): New function. | |
1610 | (exploded_node::get_dot_fillcolor): Add more colors. | |
1611 | (exploded_node::dump_dot): Guard the printing of the point and | |
1612 | state with show_enode_details_p. Print the processed stmts for | |
1613 | this enode after the initial state. | |
1614 | (exploded_node::dump_to_pp): Pass true for new multiline param | |
1615 | of program_state::dump_to_pp. | |
1616 | (exploded_node::on_stmt): Drop "change" param. Log the stmt. | |
1617 | Set input_location. Implement __analyzer_describe. Update | |
1618 | implementation of __analyzer_dump and __analyzer_eval. | |
1619 | Remove purging of sm-state for unknown fncalls from here. | |
1620 | (exploded_node::on_edge): Drop "change" param. | |
1621 | (exploded_node::on_longjmp): Port from region_id/svalue_id to | |
1622 | const region */const svalue *. Call program_state::detect_leaks. | |
1623 | Drop state_change. | |
1624 | (exploded_node::detect_leaks): Update for changes to region_model. | |
1625 | Call program_state::detect_leaks. | |
1626 | (exploded_edge::exploded_edge): Drop ext_state and change params. | |
1627 | (exploded_edge::dump_dot): "args" is no longer used. Drop dumping | |
1628 | of m_change. | |
1629 | (exploded_graph::exploded_graph): Pass engine to | |
1630 | m_diagnostic_manager ctor. Use program_point::origin. | |
1631 | (exploded_graph::add_function_entry): Drop ctxt. Use | |
1632 | program_state::push_frame. Drop state_change. | |
1633 | (exploded_graph::get_or_create_node): Drop "change" param. Add | |
1634 | "enode_for_diag" param. Update dumping calls for API changes. | |
1635 | Pass point to can_merge_with_p. Show enode indices | |
1636 | within -Wanalyzer-too-complex diagnostic for hitting the per-point | |
1637 | limit. | |
1638 | (exploded_graph::add_edge): Drop "change" param. Log which nodes | |
1639 | are being connected. Update for changes to exploded_edge ctor. | |
1640 | (exploded_graph::get_per_program_point_data): New. | |
1641 | (exploded_graph::process_worklist): Pass point to | |
1642 | can_merge_with_p. Drop state_change. Update dumping call for API | |
1643 | change. | |
1644 | (exploded_graph::process_node): Drop state_change. Split the | |
1645 | node in-place if an sm-state-change occurs. Update | |
1646 | m_num_processed_stmts. Update dumping calls for API change. | |
1647 | (exploded_graph::log_stats): Call engine::log_stats. | |
1648 | (exploded_graph::dump_states_for_supernode): Update dumping | |
1649 | call. | |
1650 | (exploded_path::feasible_p): Add "eng" and "eg" params. | |
1651 | Rename "i" to "end_idx". Pass the manager to the region_model | |
1652 | ctor. Update for every processed stmt in the enode, not just the | |
1653 | first. Keep track of which snodes have been visited, and call | |
1654 | loop_replay_fixup when revisiting one. | |
1655 | (enode_label::get_text): Update dump call for new param. | |
1656 | (exploded_graph::dump_exploded_nodes): Likewise. | |
1657 | (exploded_graph::get_node_by_index): New. | |
1658 | (impl_run_checkers): Create engine instance and pass its address | |
1659 | to extrinsic_state ctor. | |
1660 | * exploded-graph.h | |
1661 | (impl_region_model_context::impl_region_model_context): Drop | |
1662 | "change" params. | |
1663 | (impl_region_model_context::void remap_svalue_ids): Delete. | |
1664 | (impl_region_model_context::on_svalue_purge): Delete. | |
1665 | (impl_region_model_context::on_svalue_leak): New. | |
1666 | (impl_region_model_context::on_liveness_change): New. | |
1667 | (impl_region_model_context::on_state_leak): Update signature. | |
1668 | (impl_region_model_context::on_inherited_svalue): Delete. | |
1669 | (impl_region_model_context::on_cast): Delete. | |
1670 | (impl_region_model_context::on_unknown_change): Update signature. | |
1671 | (impl_region_model_context::m_change): Delete. | |
1672 | (eg_traits::dump_args_t::show_enode_details_p): New. | |
1673 | (exploded_node::on_stmt): Drop "change" param. | |
1674 | (exploded_node::on_edge): Likewise. | |
1675 | (exploded_node::get_processed_stmt): New decl. | |
1676 | (exploded_node::m_num_processed_stmts): New field. | |
1677 | (exploded_edge::exploded_edge): Drop ext_state and change params. | |
1678 | (exploded_edge::m_change): Delete. | |
1679 | (exploded_graph::get_engine): New accessor. | |
1680 | (exploded_graph::get_or_create_node): Drop "change" param. Add | |
1681 | "enode_for_diag" param. | |
1682 | (exploded_graph::add_edge): Drop "change" param. | |
1683 | (exploded_graph::get_per_program_point_data): New decl. | |
1684 | (exploded_graph::get_node_by_index): New decl. | |
1685 | (exploded_path::feasible_p): Add "eng" and "eg" params. | |
1686 | * program-point.cc: Include "analyzer/store.h" before including | |
1687 | "analyzer/region-model.h". | |
1688 | (function_point::function_point): Move here from | |
1689 | program-point.h. | |
1690 | (function_point::get_function): Likewise. | |
1691 | (function_point::from_function_entry): Likewise. | |
1692 | (function_point::before_supernode): Likewise. | |
1693 | (function_point::next_stmt): New function. | |
1694 | * program-point.h (function_point::function_point): Move | |
1695 | implementation from here to program-point.cc. | |
1696 | (function_point::get_function): Likewise. | |
1697 | (function_point::from_function_entry): Likewise. | |
1698 | (function_point::before_supernode): Likewise. | |
1699 | (function_point::next_stmt): New decl. | |
1700 | (program_point::operator!=): New. | |
1701 | (program_point::origin): New. | |
1702 | (program_point::next_stmt): New. | |
1703 | (program_point::m_function_point): Make non-const. | |
1704 | * program-state.cc: Move includes of "analyzer/call-string.h" and | |
1705 | "analyzer/program-point.h" to before "analyzer/region-model.h", | |
1706 | and also include "analyzer/store.h" before it. | |
1707 | (extrinsic_state::get_model_manager): New. | |
1708 | (sm_state_map::sm_state_map): Pass in sm and sm_idx to ctor, | |
1709 | rather than pass the around. | |
1710 | (sm_state_map::clone_with_remapping): Delete. | |
1711 | (sm_state_map::print): Remove "sm" param in favor of "m_sm". Add | |
1712 | "simple" and "multiline" params and support multiline vs single | |
1713 | line dumping. | |
1714 | (sm_state_map::dump): Remove "sm" param in favor of "m_sm". Add | |
1715 | "simple" param. | |
1716 | (sm_state_map::hash): Port from svalue_id to const svalue *. | |
1717 | (sm_state_map::operator==): Likewise. | |
1718 | (sm_state_map::get_state): Likewise. Call canonicalize_svalue on | |
1719 | input. Handle inheritance of sm-state. Call get_default_state. | |
1720 | (sm_state_map::get_origin): Port from svalue_id to const svalue *. | |
1721 | (sm_state_map::set_state): Likewise. Pass in ext_state. Reject | |
1722 | attempts to set state on UNKNOWN. | |
1723 | (sm_state_map::impl_set_state): Port from svalue_id to | |
1724 | const svalue *. Pass in ext_state. Call canonicalize_svalue on | |
1725 | input. | |
1726 | (sm_state_map::purge_for_unknown_fncall): Delete. | |
1727 | (sm_state_map::on_svalue_leak): New. | |
1728 | (sm_state_map::remap_svalue_ids): Delete. | |
1729 | (sm_state_map::on_liveness_change): New. | |
1730 | (sm_state_map::on_unknown_change): Reimplement. | |
1731 | (sm_state_map::on_svalue_purge): Delete. | |
1732 | (sm_state_map::on_inherited_svalue): Delete. | |
1733 | (sm_state_map::on_cast): Delete. | |
1734 | (sm_state_map::validate): Delete. | |
1735 | (sm_state_map::canonicalize_svalue): New. | |
1736 | (program_state::program_state): Update to pass manager to | |
1737 | region_model's ctor. Constify num_states and pass state machine | |
1738 | and index to sm_state_map ctor. | |
1739 | (program_state::print): Update for changes to dump API. | |
1740 | (program_state::dump_to_pp): Ignore the summarize param. Add | |
1741 | "multiline" param. | |
1742 | (program_state::dump_to_file): Add "multiline" param. | |
1743 | (program_state::dump): Pass "true" for new "multiline" param. | |
1744 | (program_state::push_frame): New. | |
1745 | (program_state::on_edge): Drop "change" param. Call | |
1746 | program_state::detect_leaks. | |
1747 | (program_state::prune_for_point): Add enode_for_diag param. | |
1748 | Reimplement based on store class. Call detect_leaks | |
1749 | (program_state::remap_svalue_ids): Delete. | |
1750 | (program_state::get_representative_tree): Port from svalue_id to | |
1751 | const svalue *. | |
1752 | (program_state::can_merge_with_p): Add "point" param. Add early | |
1753 | reject for sm-differences. Drop id remapping. | |
1754 | (program_state::validate): Drop region model and sm_state_map | |
1755 | validation. | |
1756 | (state_change::sm_change::dump): Delete. | |
1757 | (state_change::sm_change::remap_svalue_ids): Delete. | |
1758 | (state_change::sm_change::on_svalue_purge): Delete. | |
1759 | (log_set_of_svalues): New. | |
1760 | (state_change::sm_change::validate): Delete. | |
1761 | (state_change::state_change): Delete. | |
1762 | (state_change::add_sm_change): Delete. | |
1763 | (state_change::affects_p): Delete. | |
1764 | (state_change::dump): Delete. | |
1765 | (state_change::remap_svalue_ids): Delete. | |
1766 | (state_change::on_svalue_purge): Delete. | |
1767 | (state_change::validate): Delete. | |
1768 | (selftest::assert_dump_eq): Delete. | |
1769 | (ASSERT_DUMP_EQ): Delete. | |
1770 | (selftest::test_sm_state_map): Update for changes to region_model | |
1771 | and sm_state_map, porting from svalue_id to const svalue *. | |
1772 | (selftest::test_program_state_dumping): Likewise. Drop test of | |
1773 | dumping, renaming to... | |
1774 | (selftest::test_program_state_1): ...this. | |
1775 | (selftest::test_program_state_dumping_2): Likewise, renaming to... | |
1776 | (selftest::test_program_state_2): ...this. | |
1777 | (selftest::test_program_state_merging): Update for changes to | |
1778 | region_model. | |
1779 | (selftest::test_program_state_merging_2): Likewise. | |
1780 | (selftest::analyzer_program_state_cc_tests): Update for renamed | |
1781 | tests. | |
1782 | * program-state.h (extrinsic_state::extrinsic_state): Add logger | |
1783 | and engine params. | |
1784 | (extrinsic_state::get_logger): New accessor. | |
1785 | (extrinsic_state::get_engine): New accessor. | |
1786 | (extrinsic_state::get_model_manager): New accessor. | |
1787 | (extrinsic_state::m_logger): New field. | |
1788 | (extrinsic_state::m_engine): New field. | |
1789 | (struct default_hash_traits<svalue_id>): Delete. | |
1790 | (pod_hash_traits<svalue_id>::hash): Delete. | |
1791 | (pod_hash_traits<svalue_id>::equal): Delete. | |
1792 | (pod_hash_traits<svalue_id>::mark_deleted): Delete. | |
1793 | (pod_hash_traits<svalue_id>::mark_empty): Delete. | |
1794 | (pod_hash_traits<svalue_id>::is_deleted): Delete. | |
1795 | (pod_hash_traits<svalue_id>::is_empty): Delete. | |
1796 | (sm_state_map::entry_t::entry_t): Port from svalue_id to | |
1797 | const svalue *. | |
1798 | (sm_state_map::entry_t::m_origin): Likewise. | |
1799 | (sm_state_map::map_t): Likewise. | |
1800 | (sm_state_map::sm_state_map): Add state_machine and index params. | |
1801 | (sm_state_map::clone_with_remapping): Delete. | |
1802 | (sm_state_map::print): Drop sm param; add simple and multiline | |
1803 | params. | |
1804 | (sm_state_map::dump): Drop sm param; add simple param. | |
1805 | (sm_state_map::get_state): Port from svalue_id to const svalue *. | |
1806 | Add ext_state param. | |
1807 | (sm_state_map::get_origin): Likewise. | |
1808 | (sm_state_map::set_state): Likewise. | |
1809 | (sm_state_map::impl_set_state): Likewise. | |
1810 | (sm_state_map::purge_for_unknown_fncall): Delete. | |
1811 | (sm_state_map::remap_svalue_ids): Delete. | |
1812 | (sm_state_map::on_svalue_purge): Delete. | |
1813 | (sm_state_map::on_svalue_leak): New. | |
1814 | (sm_state_map::on_liveness_change): New. | |
1815 | (sm_state_map::on_inherited_svalue): Delete. | |
1816 | (sm_state_map::on_cast): Delete. | |
1817 | (sm_state_map::validate): Delete. | |
1818 | (sm_state_map::on_unknown_change): Port from svalue_id to | |
1819 | const svalue *. Add is_mutable and ext_state params. | |
1820 | (sm_state_map::canonicalize_svalue): New. | |
1821 | (sm_state_map::m_sm): New field. | |
1822 | (sm_state_map::m_sm_idx): New field. | |
1823 | (program_state::operator=): Delete. | |
1824 | (program_state::dump_to_pp): Drop "summarize" param, adding | |
1825 | "simple" and "multiline". | |
1826 | (program_state::dump_to_file): Likewise. | |
1827 | (program_state::dump): Rename "summarize" to "simple". | |
1828 | (program_state::push_frame): New. | |
1829 | (program_state::get_current_function): New. | |
1830 | (program_state::on_edge): Drop "change" param. | |
1831 | (program_state::prune_for_point): Likewise. Add enode_for_diag | |
1832 | param. | |
1833 | (program_state::remap_svalue_ids): Delete. | |
1834 | (program_state::get_representative_tree): Port from svalue_id to | |
1835 | const svalue *. | |
1836 | (program_state::can_purge_p): Likewise. Pass ext_state to get_state. | |
1837 | (program_state::can_merge_with_p): Add point param. | |
1838 | (program_state::detect_leaks): New. | |
1839 | (state_change_visitor::on_state_change): Port from tree and | |
1840 | svalue_id to a pair of const svalue *. | |
1841 | (class state_change): Delete. | |
1842 | * region.cc: New file. | |
1843 | * region-model-impl-calls.cc: New file. | |
1844 | * region-model-manager.cc: New file. | |
1845 | * region-model-reachability.cc: New file. | |
1846 | * region-model-reachability.h: New file. | |
1847 | * region-model.cc: Include "analyzer/call-string.h", | |
1848 | "analyzer/program-point.h", and "analyzer/store.h" before | |
1849 | "analyzer/region-model.h". Include | |
1850 | "analyzer/region-model-reachability.h". | |
1851 | (dump_tree): Make non-static. | |
1852 | (dump_quoted_tree): Make non-static. | |
1853 | (print_quoted_type): Make non-static. | |
1854 | (path_var::dump): Delete. | |
1855 | (dump_separator): Delete. | |
1856 | (class impl_constraint_manager): Delete. | |
1857 | (svalue_id::print): Delete. | |
1858 | (svalue_id::dump_node_name_to_pp): Delete. | |
1859 | (svalue_id::validate): Delete. | |
1860 | (region_id::print): Delete. | |
1861 | (region_id::dump_node_name_to_pp): Delete. | |
1862 | (region_id::validate): Delete. | |
1863 | (region_id_set::region_id_set): Delete. | |
1864 | (svalue_id_set::svalue_id_set): Delete. | |
1865 | (svalue::operator==): Delete. | |
1866 | (svalue::hash): Delete. | |
1867 | (svalue::print): Delete. | |
1868 | (svalue::dump_dot_to_pp): Delete. | |
1869 | (svalue::remap_region_ids): Delete. | |
1870 | (svalue::walk_for_canonicalization): Delete. | |
1871 | (svalue::get_child_sid): Delete. | |
1872 | (svalue::maybe_get_constant): Delete. | |
1873 | (region_svalue::compare_fields): Delete. | |
1874 | (region_svalue::add_to_hash): Delete. | |
1875 | (region_svalue::print_details): Delete. | |
1876 | (region_svalue::dump_dot_to_pp): Delete. | |
1877 | (region_svalue::remap_region_ids): Delete. | |
1878 | (region_svalue::merge_values): Delete. | |
1879 | (region_svalue::walk_for_canonicalization): Delete. | |
1880 | (region_svalue::eval_condition): Delete. | |
1881 | (constant_svalue::compare_fields): Delete. | |
1882 | (constant_svalue::add_to_hash): Delete. | |
1883 | (constant_svalue::merge_values): Delete. | |
1884 | (constant_svalue::eval_condition): Move to svalue.cc. | |
1885 | (constant_svalue::print_details): Delete. | |
1886 | (constant_svalue::get_child_sid): Delete. | |
1887 | (unknown_svalue::compare_fields): Delete. | |
1888 | (unknown_svalue::add_to_hash): Delete. | |
1889 | (unknown_svalue::print_details): Delete. | |
1890 | (poison_kind_to_str): Move to svalue.cc. | |
1891 | (poisoned_svalue::compare_fields): Delete. | |
1892 | (poisoned_svalue::add_to_hash): Delete. | |
1893 | (poisoned_svalue::print_details): Delete. | |
1894 | (region_kind_to_str): Move to region.cc and reimplement. | |
1895 | (region::operator==): Delete. | |
1896 | (region::get_parent_region): Delete. | |
1897 | (region::set_value): Delete. | |
1898 | (region::become_active_view): Delete. | |
1899 | (region::deactivate_any_active_view): Delete. | |
1900 | (region::deactivate_view): Delete. | |
1901 | (region::get_value): Delete. | |
1902 | (region::get_inherited_child_sid): Delete. | |
1903 | (region_model::copy_region): Delete. | |
1904 | (region_model::copy_struct_region): Delete. | |
1905 | (region_model::copy_union_region): Delete. | |
1906 | (region_model::copy_array_region): Delete. | |
1907 | (region::hash): Delete. | |
1908 | (region::print): Delete. | |
1909 | (region::dump_dot_to_pp): Delete. | |
1910 | (region::dump_to_pp): Delete. | |
1911 | (region::dump_child_label): Delete. | |
1912 | (region::validate): Delete. | |
1913 | (region::remap_svalue_ids): Delete. | |
1914 | (region::remap_region_ids): Delete. | |
1915 | (region::add_view): Delete. | |
1916 | (region::get_view): Delete. | |
1917 | (region::region): Move to region.cc. | |
1918 | (region::add_to_hash): Delete. | |
1919 | (region::print_fields): Delete. | |
1920 | (region::non_null_p): Delete. | |
1921 | (primitive_region::clone): Delete. | |
1922 | (primitive_region::walk_for_canonicalization): Delete. | |
1923 | (map_region::map_region): Delete. | |
1924 | (map_region::compare_fields): Delete. | |
1925 | (map_region::print_fields): Delete. | |
1926 | (map_region::validate): Delete. | |
1927 | (map_region::dump_dot_to_pp): Delete. | |
1928 | (map_region::dump_child_label): Delete. | |
1929 | (map_region::get_or_create): Delete. | |
1930 | (map_region::get): Delete. | |
1931 | (map_region::add_to_hash): Delete. | |
1932 | (map_region::remap_region_ids): Delete. | |
1933 | (map_region::unbind): Delete. | |
1934 | (map_region::get_tree_for_child_region): Delete. | |
1935 | (map_region::get_tree_for_child_region): Delete. | |
1936 | (tree_cmp): Move to region.cc. | |
1937 | (map_region::can_merge_p): Delete. | |
1938 | (map_region::walk_for_canonicalization): Delete. | |
1939 | (map_region::get_value_by_name): Delete. | |
1940 | (struct_or_union_region::valid_key_p): Delete. | |
1941 | (struct_or_union_region::compare_fields): Delete. | |
1942 | (struct_region::clone): Delete. | |
1943 | (struct_region::compare_fields): Delete. | |
1944 | (union_region::clone): Delete. | |
1945 | (union_region::compare_fields): Delete. | |
1946 | (frame_region::compare_fields): Delete. | |
1947 | (frame_region::clone): Delete. | |
1948 | (frame_region::valid_key_p): Delete. | |
1949 | (frame_region::print_fields): Delete. | |
1950 | (frame_region::add_to_hash): Delete. | |
1951 | (globals_region::compare_fields): Delete. | |
1952 | (globals_region::clone): Delete. | |
1953 | (globals_region::valid_key_p): Delete. | |
1954 | (code_region::compare_fields): Delete. | |
1955 | (code_region::clone): Delete. | |
1956 | (code_region::valid_key_p): Delete. | |
1957 | (array_region::array_region): Delete. | |
1958 | (array_region::get_element): Delete. | |
1959 | (array_region::clone): Delete. | |
1960 | (array_region::compare_fields): Delete. | |
1961 | (array_region::print_fields): Delete. | |
1962 | (array_region::validate): Delete. | |
1963 | (array_region::dump_dot_to_pp): Delete. | |
1964 | (array_region::dump_child_label): Delete. | |
1965 | (array_region::get_or_create): Delete. | |
1966 | (array_region::get): Delete. | |
1967 | (array_region::add_to_hash): Delete. | |
1968 | (array_region::remap_region_ids): Delete. | |
1969 | (array_region::get_key_for_child_region): Delete. | |
1970 | (array_region::key_cmp): Delete. | |
1971 | (array_region::walk_for_canonicalization): Delete. | |
1972 | (array_region::key_from_constant): Delete. | |
1973 | (array_region::constant_from_key): Delete. | |
1974 | (function_region::compare_fields): Delete. | |
1975 | (function_region::clone): Delete. | |
1976 | (function_region::valid_key_p): Delete. | |
1977 | (stack_region::stack_region): Delete. | |
1978 | (stack_region::compare_fields): Delete. | |
1979 | (stack_region::clone): Delete. | |
1980 | (stack_region::print_fields): Delete. | |
1981 | (stack_region::dump_child_label): Delete. | |
1982 | (stack_region::validate): Delete. | |
1983 | (stack_region::push_frame): Delete. | |
1984 | (stack_region::get_current_frame_id): Delete. | |
1985 | (stack_region::pop_frame): Delete. | |
1986 | (stack_region::add_to_hash): Delete. | |
1987 | (stack_region::remap_region_ids): Delete. | |
1988 | (stack_region::can_merge_p): Delete. | |
1989 | (stack_region::walk_for_canonicalization): Delete. | |
1990 | (stack_region::get_value_by_name): Delete. | |
1991 | (heap_region::heap_region): Delete. | |
1992 | (heap_region::compare_fields): Delete. | |
1993 | (heap_region::clone): Delete. | |
1994 | (heap_region::walk_for_canonicalization): Delete. | |
1995 | (root_region::root_region): Delete. | |
1996 | (root_region::compare_fields): Delete. | |
1997 | (root_region::clone): Delete. | |
1998 | (root_region::print_fields): Delete. | |
1999 | (root_region::validate): Delete. | |
2000 | (root_region::dump_child_label): Delete. | |
2001 | (root_region::push_frame): Delete. | |
2002 | (root_region::get_current_frame_id): Delete. | |
2003 | (root_region::pop_frame): Delete. | |
2004 | (root_region::ensure_stack_region): Delete. | |
2005 | (root_region::get_stack_region): Delete. | |
2006 | (root_region::ensure_globals_region): Delete. | |
2007 | (root_region::get_code_region): Delete. | |
2008 | (root_region::ensure_code_region): Delete. | |
2009 | (root_region::get_globals_region): Delete. | |
2010 | (root_region::ensure_heap_region): Delete. | |
2011 | (root_region::get_heap_region): Delete. | |
2012 | (root_region::remap_region_ids): Delete. | |
2013 | (root_region::can_merge_p): Delete. | |
2014 | (root_region::add_to_hash): Delete. | |
2015 | (root_region::walk_for_canonicalization): Delete. | |
2016 | (root_region::get_value_by_name): Delete. | |
2017 | (symbolic_region::symbolic_region): Delete. | |
2018 | (symbolic_region::compare_fields): Delete. | |
2019 | (symbolic_region::clone): Delete. | |
2020 | (symbolic_region::walk_for_canonicalization): Delete. | |
2021 | (symbolic_region::print_fields): Delete. | |
2022 | (region_model::region_model): Add region_model_manager * param. | |
2023 | Reimplement in terms of store, dropping impl_constraint_manager | |
2024 | subclass. | |
2025 | (region_model::operator=): Reimplement in terms of store | |
2026 | (region_model::operator==): Likewise. | |
2027 | (region_model::hash): Likewise. | |
2028 | (region_model::print): Delete. | |
2029 | (region_model::print_svalue): Delete. | |
2030 | (region_model::dump_dot_to_pp): Delete. | |
2031 | (region_model::dump_dot_to_file): Delete. | |
2032 | (region_model::dump_dot): Delete. | |
2033 | (region_model::dump_to_pp): Replace "summarize" param with | |
2034 | "simple" and "multiline". Port to store-based implementation. | |
2035 | (region_model::dump): Replace "summarize" param with "simple" and | |
2036 | "multiline". | |
2037 | (dump_vec_of_tree): Delete. | |
2038 | (region_model::dump_summary_of_rep_path_vars): Delete. | |
2039 | (region_model::validate): Delete. | |
2040 | (svalue_id_cmp_by_constant_svalue_model): Delete. | |
2041 | (svalue_id_cmp_by_constant_svalue): Delete. | |
2042 | (region_model::canonicalize): Drop "ctxt" param. Reimplement in | |
2043 | terms of store and constraints. | |
2044 | (region_model::canonicalized_p): Remove NULL arg to canonicalize. | |
2045 | (region_model::loop_replay_fixup): New. | |
2046 | (poisoned_value_diagnostic::emit): Tweak wording of warnings. | |
2047 | (region_model::check_for_poison): Delete. | |
2048 | (region_model::get_gassign_result): New. | |
2049 | (region_model::on_assignment): Port to store-based implementation. | |
2050 | (region_model::on_call_pre): Delete calls to check_for_poison. | |
2051 | Move implementations to region-model-impl-calls.c and port to | |
2052 | store-based implementation. | |
2053 | (region_model::on_call_post): Likewise. | |
2054 | (class reachable_regions): Move to region-model-reachability.h/cc | |
2055 | and port to store-based implementation. | |
2056 | (region_model::handle_unrecognized_call): Port to store-based | |
2057 | implementation. | |
2058 | (region_model::get_reachable_svalues): New. | |
2059 | (region_model::on_setjmp): Port to store-based implementation. | |
2060 | (region_model::on_longjmp): Likewise. | |
2061 | (region_model::handle_phi): Drop is_back_edge param and the logic | |
2062 | using it. | |
2063 | (region_model::get_lvalue_1): Port from region_id to const region *. | |
2064 | (region_model::make_region_for_unexpected_tree_code): Delete. | |
2065 | (assert_compat_types): If the check fails, use internal_error to | |
2066 | show the types. | |
2067 | (region_model::get_lvalue): Port from region_id to const region *. | |
2068 | (region_model::get_rvalue_1): Port from svalue_id to const svalue *. | |
2069 | (region_model::get_rvalue): Likewise. | |
2070 | (region_model::get_or_create_ptr_svalue): Delete. | |
2071 | (region_model::get_or_create_constant_svalue): Delete. | |
2072 | (region_model::get_svalue_for_fndecl): Delete. | |
2073 | (region_model::get_region_for_fndecl): Delete. | |
2074 | (region_model::get_svalue_for_label): Delete. | |
2075 | (region_model::get_region_for_label): Delete. | |
2076 | (build_cast): Delete. | |
2077 | (region_model::maybe_cast_1): Delete. | |
2078 | (region_model::maybe_cast): Delete. | |
2079 | (region_model::get_field_region): Delete. | |
2080 | (region_model::get_store_value): New. | |
2081 | (region_model::region_exists_p): New. | |
2082 | (region_model::deref_rvalue): Port from svalue_id to const svalue *. | |
2083 | (region_model::set_value): Likewise. | |
2084 | (region_model::clobber_region): New. | |
2085 | (region_model::purge_region): New. | |
2086 | (region_model::zero_fill_region): New. | |
2087 | (region_model::mark_region_as_unknown): New. | |
2088 | (region_model::eval_condition): Port from svalue_id to | |
2089 | const svalue *. | |
2090 | (region_model::eval_condition_without_cm): Likewise. | |
2091 | (region_model::compare_initial_and_pointer): New. | |
2092 | (region_model::add_constraint): Port from svalue_id to | |
2093 | const svalue *. | |
2094 | (region_model::maybe_get_constant): Delete. | |
2095 | (region_model::get_representative_path_var): New. | |
2096 | (region_model::add_new_malloc_region): Delete. | |
2097 | (region_model::get_representative_tree): Port to const svalue *. | |
2098 | (region_model::get_representative_path_var): Port to | |
2099 | const region *. | |
2100 | (region_model::get_path_vars_for_svalue): Delete. | |
2101 | (region_model::set_to_new_unknown_value): Delete. | |
2102 | (region_model::update_for_phis): Don't pass is_back_edge to handle_phi. | |
2103 | (region_model::update_for_call_superedge): Port from svalue_id to | |
2104 | const svalue *. | |
2105 | (region_model::update_for_return_superedge): Port to store-based | |
2106 | implementation. | |
2107 | (region_model::update_for_call_summary): Replace | |
2108 | set_to_new_unknown_value with mark_region_as_unknown. | |
2109 | (region_model::get_root_region): Delete. | |
2110 | (region_model::get_stack_region_id): Delete. | |
2111 | (region_model::push_frame): Delete. | |
2112 | (region_model::get_current_frame_id): Delete. | |
2113 | (region_model::get_current_function): Delete. | |
2114 | (region_model::pop_frame): Delete. | |
2115 | (region_model::on_top_level_param): New. | |
2116 | (region_model::get_stack_depth): Delete. | |
2117 | (region_model::get_function_at_depth): Delete. | |
2118 | (region_model::get_globals_region_id): Delete. | |
2119 | (region_model::add_svalue): Delete. | |
2120 | (region_model::replace_svalue): Delete. | |
2121 | (region_model::add_region): Delete. | |
2122 | (region_model::get_svalue): Delete. | |
2123 | (region_model::get_region): Delete. | |
2124 | (make_region_for_type): Delete. | |
2125 | (region_model::add_region_for_type): Delete. | |
2126 | (region_model::on_top_level_param): New. | |
2127 | (class restrict_to_used_svalues): Delete. | |
2128 | (region_model::purge_unused_svalues): Delete. | |
2129 | (region_model::push_frame): New. | |
2130 | (region_model::remap_svalue_ids): Delete. | |
2131 | (region_model::remap_region_ids): Delete. | |
2132 | (region_model::purge_regions): Delete. | |
2133 | (region_model::get_descendents): Delete. | |
2134 | (region_model::delete_region_and_descendents): Delete. | |
2135 | (region_model::poison_any_pointers_to_bad_regions): Delete. | |
2136 | (region_model::can_merge_with_p): Delete. | |
2137 | (region_model::get_current_function): New. | |
2138 | (region_model::get_value_by_name): Delete. | |
2139 | (region_model::convert_byte_offset_to_array_index): Delete. | |
2140 | (region_model::pop_frame): New. | |
2141 | (region_model::get_or_create_mem_ref): Delete. | |
2142 | (region_model::get_stack_depth): New. | |
2143 | (region_model::get_frame_at_index): New. | |
2144 | (region_model::unbind_region_and_descendents): New. | |
2145 | (struct bad_pointer_finder): New. | |
2146 | (region_model::get_or_create_pointer_plus_expr): Delete. | |
2147 | (region_model::poison_any_pointers_to_descendents): New. | |
2148 | (region_model::get_or_create_view): Delete. | |
2149 | (region_model::can_merge_with_p): New. | |
2150 | (region_model::get_fndecl_for_call): Port from svalue_id to | |
2151 | const svalue *. | |
2152 | (struct append_ssa_names_cb_data): New. | |
2153 | (get_ssa_name_regions_for_current_frame): New. | |
2154 | (region_model::append_ssa_names_cb): New. | |
2155 | (model_merger::dump_to_pp): Add "simple" param. Drop dumping of | |
2156 | remappings. | |
2157 | (model_merger::dump): Add "simple" param to both overloads. | |
2158 | (model_merger::can_merge_values_p): Delete. | |
2159 | (model_merger::record_regions): Delete. | |
2160 | (model_merger::record_svalues): Delete. | |
2161 | (svalue_id_merger_mapping::svalue_id_merger_mapping): Delete. | |
2162 | (svalue_id_merger_mapping::dump_to_pp): Delete. | |
2163 | (svalue_id_merger_mapping::dump): Delete. | |
2164 | (region_model::create_region_for_heap_alloc): New. | |
2165 | (region_model::create_region_for_alloca): New. | |
2166 | (region_model::record_dynamic_extents): New. | |
2167 | (canonicalization::canonicalization): Delete. | |
2168 | (canonicalization::walk_rid): Delete. | |
2169 | (canonicalization::walk_sid): Delete. | |
2170 | (canonicalization::dump_to_pp): Delete. | |
2171 | (canonicalization::dump): Delete. | |
2172 | (inchash::add): Delete overloads for svalue_id and region_id. | |
2173 | (engine::log_stats): New. | |
2174 | (assert_condition): Add overload comparing svalues. | |
2175 | (assert_dump_eq): Pass "true" for multiline. | |
2176 | (selftest::test_dump): Update for rewrite of region_model. | |
2177 | (selftest::test_dump_2): Rename to... | |
2178 | (selftest::test_struct): ...this. Provide a region_model_manager | |
2179 | when creating region_model instance. Remove dump test. Add | |
2180 | checks for get_offset. | |
2181 | (selftest::test_dump_3): Rename to... | |
2182 | (selftest::test_array_1): ...this. Provide a region_model_manager | |
2183 | when creating region_model instance. Remove dump test. | |
2184 | (selftest::test_get_representative_tree): Port from svalue_id to | |
2185 | new API. Add test coverage for various expressions. | |
2186 | (selftest::test_unique_constants): Provide a region_model_manager | |
2187 | for the region_model. Add test coverage for comparing const vs | |
2188 | non-const. | |
2189 | (selftest::test_svalue_equality): Delete. | |
2190 | (selftest::test_region_equality): Delete. | |
2191 | (selftest::test_unique_unknowns): New. | |
2192 | (class purge_all_svalue_ids): Delete. | |
2193 | (class purge_one_svalue_id): Delete. | |
2194 | (selftest::test_purging_by_criteria): Delete. | |
2195 | (selftest::test_initial_svalue_folding): New. | |
2196 | (selftest::test_unaryop_svalue_folding): New. | |
2197 | (selftest::test_binop_svalue_folding): New. | |
2198 | (selftest::test_sub_svalue_folding): New. | |
2199 | (selftest::test_purge_unused_svalues): Delete. | |
2200 | (selftest::test_descendent_of_p): New. | |
2201 | (selftest::test_assignment): Provide a region_model_manager for | |
2202 | the region_model. Drop the dump test. | |
2203 | (selftest::test_compound_assignment): Likewise. | |
2204 | (selftest::test_stack_frames): Port to new implementation. | |
2205 | (selftest::test_get_representative_path_var): Likewise. | |
2206 | (selftest::test_canonicalization_1): Rename to... | |
2207 | (selftest::test_equality_1): ...this. Port to new API, and add | |
2208 | (selftest::test_canonicalization_2): Provide a | |
2209 | region_model_manager when creating region_model instances. | |
2210 | Remove redundant canicalization. | |
2211 | (selftest::test_canonicalization_3): Provide a | |
2212 | region_model_manager when creating region_model instances. | |
2213 | Remove param from calls to region_model::canonicalize. | |
2214 | (selftest::test_canonicalization_4): Likewise. | |
2215 | (selftest::assert_region_models_merge): Constify | |
2216 | out_merged_svalue. Port to new API. | |
2217 | (selftest::test_state_merging): Provide a | |
2218 | region_model_manager when creating region_model instances. | |
2219 | Provide a program_point point when merging them. Replace | |
2220 | set_to_new_unknown_value with usage of placeholder_svalues. | |
2221 | Drop get_value_by_name. Port from svalue_id to const svalue *. | |
2222 | Add test of heap allocation. | |
2223 | (selftest::test_constraint_merging): Provide a | |
2224 | region_model_manager when creating region_model instances. | |
2225 | Provide a program_point point when merging them. Eliminate use | |
2226 | of set_to_new_unknown_value. | |
2227 | (selftest::test_widening_constraints): New. | |
2228 | (selftest::test_iteration_1): New. | |
2229 | (selftest::test_malloc_constraints): Port to store-based | |
2230 | implementation. | |
2231 | (selftest::test_var): New test. | |
2232 | (selftest::test_array_2): New test. | |
2233 | (selftest::test_mem_ref): New test. | |
2234 | (selftest::test_POINTER_PLUS_EXPR_then_MEM_REF): New. | |
2235 | (selftest::test_malloc): New. | |
2236 | (selftest::test_alloca): New. | |
2237 | (selftest::analyzer_region_model_cc_tests): Update for renamings. | |
2238 | Call new functions. | |
2239 | * region-model.h (class path_var): Move to analyzer.h. | |
2240 | (class svalue_id): Delete. | |
2241 | (class region_id): Delete. | |
2242 | (class id_map): Delete. | |
2243 | (svalue_id_map): Delete. | |
2244 | (region_id_map): Delete. | |
2245 | (id_map<T>::id_map): Delete. | |
2246 | (id_map<T>::put): Delete. | |
2247 | (id_map<T>::get_dst_for_src): Delete. | |
2248 | (id_map<T>::get_src_for_dst): Delete. | |
2249 | (id_map<T>::dump_to_pp): Delete. | |
2250 | (id_map<T>::dump): Delete. | |
2251 | (id_map<T>::update): Delete. | |
2252 | (one_way_svalue_id_map): Delete. | |
2253 | (one_way_region_id_map): Delete. | |
2254 | (class region_id_set): Delete. | |
2255 | (class svalue_id_set): Delete. | |
2256 | (struct complexity): New. | |
2257 | (class visitor): New. | |
2258 | (enum svalue_kind): Add SK_SETJMP, SK_INITIAL, SK_UNARYOP, | |
2259 | SK_BINOP, SK_SUB,SK_UNMERGEABLE, SK_PLACEHOLDER, SK_WIDENING, | |
2260 | SK_COMPOUND, and SK_CONJURED. | |
2261 | (svalue::operator==): Delete. | |
2262 | (svalue::operator!=): Delete. | |
2263 | (svalue::clone): Delete. | |
2264 | (svalue::hash): Delete. | |
2265 | (svalue::dump_dot_to_pp): Delete. | |
2266 | (svalue::dump_to_pp): New. | |
2267 | (svalue::dump): New. | |
2268 | (svalue::get_desc): New. | |
2269 | (svalue::dyn_cast_initial_svalue): New. | |
2270 | (svalue::dyn_cast_unaryop_svalue): New. | |
2271 | (svalue::dyn_cast_binop_svalue): New. | |
2272 | (svalue::dyn_cast_sub_svalue): New. | |
2273 | (svalue::dyn_cast_unmergeable_svalue): New. | |
2274 | (svalue::dyn_cast_widening_svalue): New. | |
2275 | (svalue::dyn_cast_compound_svalue): New. | |
2276 | (svalue::dyn_cast_conjured_svalue): New. | |
2277 | (svalue::maybe_undo_cast): New. | |
2278 | (svalue::unwrap_any_unmergeable): New. | |
2279 | (svalue::remap_region_ids): Delete | |
2280 | (svalue::can_merge_p): New. | |
2281 | (svalue::walk_for_canonicalization): Delete | |
2282 | (svalue::get_complexity): New. | |
2283 | (svalue::get_child_sid): Delete | |
2284 | (svalue::accept): New. | |
2285 | (svalue::live_p): New. | |
2286 | (svalue::implicitly_live_p): New. | |
2287 | (svalue::svalue): Add complexity param. | |
2288 | (svalue::add_to_hash): Delete | |
2289 | (svalue::print_details): Delete | |
2290 | (svalue::m_complexity): New field. | |
2291 | (region_svalue::key_t): New struct. | |
2292 | (region_svalue::region_svalue): Port from region_id to | |
2293 | const region_id *. Add complexity. | |
2294 | (region_svalue::compare_fields): Delete. | |
2295 | (region_svalue::clone): Delete. | |
2296 | (region_svalue::dump_dot_to_pp): Delete. | |
2297 | (region_svalue::get_pointee): Port from region_id to | |
2298 | const region_id *. | |
2299 | (region_svalue::remap_region_ids): Delete. | |
2300 | (region_svalue::merge_values): Delete. | |
2301 | (region_svalue::dump_to_pp): New. | |
2302 | (region_svalue::accept): New. | |
2303 | (region_svalue::walk_for_canonicalization): Delete. | |
2304 | (region_svalue::eval_condition): Make params const. | |
2305 | (region_svalue::add_to_hash): Delete. | |
2306 | (region_svalue::print_details): Delete. | |
2307 | (region_svalue::m_rid): Replace with... | |
2308 | (region_svalue::m_reg): ...this. | |
2309 | (is_a_helper <region_svalue *>::test): Convert to... | |
2310 | (is_a_helper <const region_svalue *>::test): ...this. | |
2311 | (template <> struct default_hash_traits<region_svalue::key_t>): | |
2312 | New. | |
2313 | (constant_svalue::constant_svalue): Add complexity. | |
2314 | (constant_svalue::compare_fields): Delete. | |
2315 | (constant_svalue::clone): Delete. | |
2316 | (constant_svalue::add_to_hash): Delete. | |
2317 | (constant_svalue::dump_to_pp): New. | |
2318 | (constant_svalue::accept): New. | |
2319 | (constant_svalue::implicitly_live_p): New. | |
2320 | (constant_svalue::merge_values): Delete. | |
2321 | (constant_svalue::eval_condition): Make params const. | |
2322 | (constant_svalue::get_child_sid): Delete. | |
2323 | (constant_svalue::print_details): Delete. | |
2324 | (is_a_helper <constant_svalue *>::test): Convert to... | |
2325 | (is_a_helper <const constant_svalue *>::test): ...this. | |
2326 | (class unknown_svalue): Update leading comment. | |
2327 | (unknown_svalue::unknown_svalue): Add complexity. | |
2328 | (unknown_svalue::compare_fields): Delete. | |
2329 | (unknown_svalue::add_to_hash): Delete. | |
2330 | (unknown_svalue::dyn_cast_unknown_svalue): Delete. | |
2331 | (unknown_svalue::print_details): Delete. | |
2332 | (unknown_svalue::dump_to_pp): New. | |
2333 | (unknown_svalue::accept): New. | |
2334 | (poisoned_svalue::key_t): New struct. | |
2335 | (poisoned_svalue::poisoned_svalue): Add complexity. | |
2336 | (poisoned_svalue::compare_fields): Delete. | |
2337 | (poisoned_svalue::clone): Delete. | |
2338 | (poisoned_svalue::add_to_hash): Delete. | |
2339 | (poisoned_svalue::dump_to_pp): New. | |
2340 | (poisoned_svalue::accept): New. | |
2341 | (poisoned_svalue::print_details): Delete. | |
2342 | (is_a_helper <poisoned_svalue *>::test): Convert to... | |
2343 | (is_a_helper <const poisoned_svalue *>::test): ...this. | |
2344 | (template <> struct default_hash_traits<poisoned_svalue::key_t>): | |
2345 | New. | |
2346 | (setjmp_record::add_to_hash): New. | |
2347 | (setjmp_svalue::key_t): New struct. | |
2348 | (setjmp_svalue::compare_fields): Delete. | |
2349 | (setjmp_svalue::clone): Delete. | |
2350 | (setjmp_svalue::add_to_hash): Delete. | |
2351 | (setjmp_svalue::setjmp_svalue): Add complexity. | |
2352 | (setjmp_svalue::dump_to_pp): New. | |
2353 | (setjmp_svalue::accept): New. | |
2354 | (setjmp_svalue::void print_details): Delete. | |
2355 | (is_a_helper <const setjmp_svalue *>::test): New. | |
2356 | (template <> struct default_hash_traits<setjmp_svalue::key_t>): New. | |
2357 | (class initial_svalue : public svalue): New. | |
2358 | (is_a_helper <const initial_svalue *>::test): New. | |
2359 | (class unaryop_svalue): New. | |
2360 | (is_a_helper <const unaryop_svalue *>::test): New. | |
2361 | (template <> struct default_hash_traits<unaryop_svalue::key_t>): New. | |
2362 | (class binop_svalue): New. | |
2363 | (is_a_helper <const binop_svalue *>::test): New. | |
2364 | (template <> struct default_hash_traits<binop_svalue::key_t>): New. | |
2365 | (class sub_svalue): New. | |
2366 | (is_a_helper <const sub_svalue *>::test): New. | |
2367 | (template <> struct default_hash_traits<sub_svalue::key_t>): New. | |
2368 | (class unmergeable_svalue): New. | |
2369 | (is_a_helper <const unmergeable_svalue *>::test): New. | |
2370 | (class placeholder_svalue): New. | |
2371 | (is_a_helper <placeholder_svalue *>::test): New. | |
2372 | (class widening_svalue): New. | |
2373 | (is_a_helper <widening_svalue *>::test): New. | |
2374 | (template <> struct default_hash_traits<widening_svalue::key_t>): New. | |
2375 | (class compound_svalue): New. | |
2376 | (is_a_helper <compound_svalue *>::test): New. | |
2377 | (template <> struct default_hash_traits<compound_svalue::key_t>): New. | |
2378 | (class conjured_svalue): New. | |
2379 | (is_a_helper <conjured_svalue *>::test): New. | |
2380 | (template <> struct default_hash_traits<conjured_svalue::key_t>): New. | |
2381 | (enum region_kind): Delete RK_PRIMITIVE, RK_STRUCT, RK_UNION, and | |
2382 | RK_ARRAY. Add RK_LABEL, RK_DECL, RK_FIELD, RK_ELEMENT, RK_OFFSET, | |
2383 | RK_CAST, RK_HEAP_ALLOCATED, RK_ALLOCA, RK_STRING, and RK_UNKNOWN. | |
2384 | (region_kind_to_str): Delete. | |
2385 | (region::~region): Move implementation to region.cc. | |
2386 | (region::operator==): Delete. | |
2387 | (region::operator!=): Delete. | |
2388 | (region::clone): Delete. | |
2389 | (region::get_id): New. | |
2390 | (region::cmp_ids): New. | |
2391 | (region::dyn_cast_map_region): Delete. | |
2392 | (region::dyn_cast_array_region): Delete. | |
2393 | (region::region_id get_parent): Delete. | |
2394 | (region::get_parent_region): Convert to a simple accessor. | |
2395 | (region::void set_value): Delete. | |
2396 | (region::svalue_id get_value): Delete. | |
2397 | (region::svalue_id get_value_direct): Delete. | |
2398 | (region::svalue_id get_inherited_child_sid): Delete. | |
2399 | (region::dyn_cast_frame_region): New. | |
2400 | (region::dyn_cast_function_region): New. | |
2401 | (region::dyn_cast_decl_region): New. | |
2402 | (region::dyn_cast_field_region): New. | |
2403 | (region::dyn_cast_element_region): New. | |
2404 | (region::dyn_cast_offset_region): New. | |
2405 | (region::dyn_cast_cast_region): New. | |
2406 | (region::dyn_cast_string_region): New. | |
2407 | (region::accept): New. | |
2408 | (region::get_base_region): New. | |
2409 | (region::base_region_p): New. | |
2410 | (region::descendent_of_p): New. | |
2411 | (region::maybe_get_frame_region): New. | |
2412 | (region::maybe_get_decl): New. | |
2413 | (region::hash): Delete. | |
2414 | (region::rint): Delete. | |
2415 | (region::dump_dot_to_pp): Delete. | |
2416 | (region::get_desc): New. | |
2417 | (region::dump_to_pp): Convert to vfunc, changing signature. | |
2418 | (region::dump_child_label): Delete. | |
2419 | (region::remap_svalue_ids): Delete. | |
2420 | (region::remap_region_ids): Delete. | |
2421 | (region::dump): New. | |
2422 | (region::walk_for_canonicalization): Delete. | |
2423 | (region::non_null_p): Drop region_model param. | |
2424 | (region::add_view): Delete. | |
2425 | (region::get_view): Delete. | |
2426 | (region::get_active_view): Delete. | |
2427 | (region::is_view_p): Delete. | |
2428 | (region::cmp_ptrs): New. | |
2429 | (region::validate): Delete. | |
2430 | (region::get_offset): New. | |
2431 | (region::get_byte_size): New. | |
2432 | (region::get_bit_size): New. | |
2433 | (region::get_subregions_for_binding): New. | |
2434 | (region::region): Add complexity param. Convert parent from | |
2435 | region_id to const region *. Drop svalue_id. Drop copy ctor. | |
2436 | (region::symbolic_for_unknown_ptr_p): New. | |
2437 | (region::add_to_hash): Delete. | |
2438 | (region::print_fields): Delete. | |
2439 | (region::get_complexity): New accessor. | |
2440 | (region::become_active_view): Delete. | |
2441 | (region::deactivate_any_active_view): Delete. | |
2442 | (region::deactivate_view): Delete. | |
2443 | (region::calc_offset): New. | |
2444 | (region::m_parent_rid): Delete. | |
2445 | (region::m_sval_id): Delete. | |
2446 | (region::m_complexity): New. | |
2447 | (region::m_id): New. | |
2448 | (region::m_parent): New. | |
2449 | (region::m_view_rids): Delete. | |
2450 | (region::m_is_view): Delete. | |
2451 | (region::m_active_view_rid): Delete. | |
2452 | (region::m_cached_offset): New. | |
2453 | (is_a_helper <region *>::test): Convert to... | |
2454 | (is_a_helper <const region *>::test): ... this. | |
2455 | (class primitive_region): Delete. | |
2456 | (class space_region): New. | |
2457 | (class map_region): Delete. | |
2458 | (is_a_helper <map_region *>::test): Delete. | |
2459 | (class frame_region): Reimplement. | |
2460 | (template <> struct default_hash_traits<frame_region::key_t>): | |
2461 | New. | |
2462 | (class globals_region): Reimplement. | |
2463 | (is_a_helper <globals_region *>::test): Convert to... | |
2464 | (is_a_helper <const globals_region *>::test): ...this. | |
2465 | (class struct_or_union_region): Delete. | |
2466 | (is_a_helper <struct_or_union_region *>::test): Delete. | |
2467 | (class code_region): Reimplement. | |
2468 | (is_a_helper <const code_region *>::test): New. | |
2469 | (class struct_region): Delete. | |
2470 | (is_a_helper <struct_region *>::test): Delete. | |
2471 | (class function_region): Reimplement. | |
2472 | (is_a_helper <function_region *>::test): Convert to... | |
2473 | (is_a_helper <const function_region *>::test): ...this. | |
2474 | (class union_region): Delete. | |
2475 | (is_a_helper <union_region *>::test): Delete. | |
2476 | (class label_region): New. | |
2477 | (is_a_helper <const label_region *>::test): New. | |
2478 | (class scope_region): Delete. | |
2479 | (class stack_region): Reimplement. | |
2480 | (is_a_helper <stack_region *>::test): Convert to... | |
2481 | (is_a_helper <const stack_region *>::test): ...this. | |
2482 | (class heap_region): Reimplement. | |
2483 | (is_a_helper <heap_region *>::test): Convert to... | |
2484 | (is_a_helper <const heap_region *>::test): ...this. | |
2485 | (class root_region): Reimplement. | |
2486 | (is_a_helper <root_region *>::test): Convert to... | |
2487 | (is_a_helper <const root_region *>::test): ...this. | |
2488 | (class symbolic_region): Reimplement. | |
2489 | (is_a_helper <const symbolic_region *>::test): New. | |
2490 | (template <> struct default_hash_traits<symbolic_region::key_t>): | |
2491 | New. | |
2492 | (class decl_region): New. | |
2493 | (is_a_helper <const decl_region *>::test): New. | |
2494 | (class field_region): New. | |
2495 | (template <> struct default_hash_traits<field_region::key_t>): New. | |
2496 | (class array_region): Delete. | |
2497 | (class element_region): New. | |
2498 | (is_a_helper <array_region *>::test): Delete. | |
2499 | (is_a_helper <const element_region *>::test): New. | |
2500 | (template <> struct default_hash_traits<element_region::key_t>): | |
2501 | New. | |
2502 | (class offset_region): New. | |
2503 | (is_a_helper <const offset_region *>::test): New. | |
2504 | (template <> struct default_hash_traits<offset_region::key_t>): | |
2505 | New. | |
2506 | (class cast_region): New. | |
2507 | (is_a_helper <const cast_region *>::test): New. | |
2508 | (template <> struct default_hash_traits<cast_region::key_t>): New. | |
2509 | (class heap_allocated_region): New. | |
2510 | (class alloca_region): New. | |
2511 | (class string_region): New. | |
2512 | (is_a_helper <const string_region *>::test): New. | |
2513 | (class unknown_region): New. | |
2514 | (class region_model_manager): New. | |
2515 | (struct append_ssa_names_cb_data): New. | |
2516 | (class call_details): New. | |
2517 | (region_model::region_model): Add region_model_manager param. | |
2518 | (region_model::print_svalue): Delete. | |
2519 | (region_model::dump_dot_to_pp): Delete. | |
2520 | (region_model::dump_dot_to_file): Delete. | |
2521 | (region_model::dump_dot): Delete. | |
2522 | (region_model::dump_to_pp): Drop summarize param in favor of | |
2523 | simple and multiline. | |
2524 | (region_model::dump): Likewise. | |
2525 | (region_model::summarize_to_pp): Delete. | |
2526 | (region_model::summarize): Delete. | |
2527 | (region_model::void canonicalize): Drop ctxt param. | |
2528 | (region_model::void check_for_poison): Delete. | |
2529 | (region_model::get_gassign_result): New. | |
2530 | (region_model::impl_call_alloca): New. | |
2531 | (region_model::impl_call_analyzer_describe): New. | |
2532 | (region_model::impl_call_analyzer_eval): New. | |
2533 | (region_model::impl_call_builtin_expect): New. | |
2534 | (region_model::impl_call_calloc): New. | |
2535 | (region_model::impl_call_free): New. | |
2536 | (region_model::impl_call_malloc): New. | |
2537 | (region_model::impl_call_memset): New. | |
2538 | (region_model::impl_call_strlen): New. | |
2539 | (region_model::get_reachable_svalues): New. | |
2540 | (region_model::handle_phi): Drop is_back_edge param. | |
2541 | (region_model::region_id get_root_rid): Delete. | |
2542 | (region_model::root_region *get_root_region): Delete. | |
2543 | (region_model::region_id get_stack_region_id): Delete. | |
2544 | (region_model::push_frame): Convert from region_id and svalue_id | |
2545 | to const region * and const svalue *. | |
2546 | (region_model::get_current_frame_id): Replace with... | |
2547 | (region_model::get_current_frame): ...this. | |
2548 | (region_model::pop_frame): Convert from region_id to | |
2549 | const region *. Drop purge and stats param. Add out_result. | |
2550 | (region_model::function *get_function_at_depth): Delete. | |
2551 | (region_model::get_globals_region_id): Delete. | |
2552 | (region_model::add_svalue): Delete. | |
2553 | (region_model::replace_svalue): Delete. | |
2554 | (region_model::add_region): Delete. | |
2555 | (region_model::add_region_for_type): Delete. | |
2556 | (region_model::get_svalue): Delete. | |
2557 | (region_model::get_region): Delete. | |
2558 | (region_model::get_lvalue): Convert from region_id to | |
2559 | const region *. | |
2560 | (region_model::get_rvalue): Convert from svalue_id to | |
2561 | const svalue *. | |
2562 | (region_model::get_or_create_ptr_svalue): Delete. | |
2563 | (region_model::get_or_create_constant_svalue): Delete. | |
2564 | (region_model::get_svalue_for_fndecl): Delete. | |
2565 | (region_model::get_svalue_for_label): Delete. | |
2566 | (region_model::get_region_for_fndecl): Delete. | |
2567 | (region_model::get_region_for_label): Delete. | |
2568 | (region_model::get_frame_at_index (int index) const;): New. | |
2569 | (region_model::maybe_cast): Delete. | |
2570 | (region_model::maybe_cast_1): Delete. | |
2571 | (region_model::get_field_region): Delete. | |
2572 | (region_model::id deref_rvalue): Convert from region_id and | |
2573 | svalue_id to const region * and const svalue *. Drop overload, | |
2574 | passing in both a tree and an svalue. | |
2575 | (region_model::set_value): Convert from region_id and svalue_id to | |
2576 | const region * and const svalue *. | |
2577 | (region_model::set_to_new_unknown_value): Delete. | |
2578 | (region_model::clobber_region (const region *reg);): New. | |
2579 | (region_model::purge_region (const region *reg);): New. | |
2580 | (region_model::zero_fill_region (const region *reg);): New. | |
2581 | (region_model::mark_region_as_unknown (const region *reg);): New. | |
2582 | (region_model::copy_region): Convert from region_id to | |
2583 | const region *. | |
2584 | (region_model::eval_condition): Convert from svalue_id to | |
2585 | const svalue *. | |
2586 | (region_model::eval_condition_without_cm): Likewise. | |
2587 | (region_model::compare_initial_and_pointer): New. | |
2588 | (region_model:maybe_get_constant): Delete. | |
2589 | (region_model::add_new_malloc_region): Delete. | |
2590 | (region_model::get_representative_tree): Convert from svalue_id to | |
2591 | const svalue *. | |
2592 | (region_model::get_representative_path_var): Delete decl taking a | |
2593 | region_id in favor of two decls, for svalue vs region, with an | |
2594 | svalue_set to ensure termination. | |
2595 | (region_model::get_path_vars_for_svalue): Delete. | |
2596 | (region_model::create_region_for_heap_alloc): New. | |
2597 | (region_model::create_region_for_alloca): New. | |
2598 | (region_model::purge_unused_svalues): Delete. | |
2599 | (region_model::remap_svalue_ids): Delete. | |
2600 | (region_model::remap_region_ids): Delete. | |
2601 | (region_model::purge_regions): Delete. | |
2602 | (region_model::get_num_svalues): Delete. | |
2603 | (region_model::get_num_regions): Delete. | |
2604 | (region_model::get_descendents): Delete. | |
2605 | (region_model::get_store): New. | |
2606 | (region_model::delete_region_and_descendents): Delete. | |
2607 | (region_model::get_manager): New. | |
2608 | (region_model::unbind_region_and_descendents): New. | |
2609 | (region_model::can_merge_with_p): Add point param. Drop | |
2610 | svalue_id_merger_mapping. | |
2611 | (region_model::get_value_by_name): Delete. | |
2612 | (region_model::convert_byte_offset_to_array_index): Delete. | |
2613 | (region_model::get_or_create_mem_ref): Delete. | |
2614 | (region_model::get_or_create_pointer_plus_expr): Delete. | |
2615 | (region_model::get_or_create_view): Delete. | |
2616 | (region_model::get_lvalue_1): Convert from region_id to | |
2617 | const region *. | |
2618 | (region_model::get_rvalue_1): Convert from svalue_id to | |
2619 | const svalue *. | |
2620 | (region_model::get_ssa_name_regions_for_current_frame): New. | |
2621 | (region_model::append_ssa_names_cb): New. | |
2622 | (region_model::get_store_value): New. | |
2623 | (region_model::copy_struct_region): Delete. | |
2624 | (region_model::copy_union_region): Delete. | |
2625 | (region_model::copy_array_region): Delete. | |
2626 | (region_model::region_exists_p): New. | |
2627 | (region_model::make_region_for_unexpected_tree_code): Delete. | |
2628 | (region_model::loop_replay_fixup): New. | |
2629 | (region_model::poison_any_pointers_to_bad_regions): Delete. | |
2630 | (region_model::poison_any_pointers_to_descendents): New. | |
2631 | (region_model::dump_summary_of_rep_path_vars): Delete. | |
2632 | (region_model::on_top_level_param): New. | |
2633 | (region_model::record_dynamic_extents): New. | |
2634 | (region_model::m_mgr;): New. | |
2635 | (region_model::m_store;): New. | |
2636 | (region_model::m_svalues;): Delete. | |
2637 | (region_model::m_regions;): Delete. | |
2638 | (region_model::m_root_rid;): Delete. | |
2639 | (region_model::m_current_frame;): New. | |
2640 | (region_model_context::remap_svalue_ids): Delete. | |
2641 | (region_model_context::can_purge_p): Delete. | |
2642 | (region_model_context::on_svalue_leak): New. | |
2643 | (region_model_context::on_svalue_purge): Delete. | |
2644 | (region_model_context::on_liveness_change): New. | |
2645 | (region_model_context::on_inherited_svalue): Delete. | |
2646 | (region_model_context::on_cast): Delete. | |
2647 | (region_model_context::on_unknown_change): Convert from svalue_id to | |
2648 | const svalue * and add is_mutable. | |
2649 | (class noop_region_model_context): Update for region_model_context | |
2650 | changes. | |
2651 | (model_merger::model_merger): Add program_point. Drop | |
2652 | svalue_id_merger_mapping. | |
2653 | (model_merger::dump_to_pp): Add "simple" param. | |
2654 | (model_merger::dump): Likewise. | |
2655 | (model_merger::get_region_a): Delete. | |
2656 | (model_merger::get_region_b): Delete. | |
2657 | (model_merger::can_merge_values_p): Delete. | |
2658 | (model_merger::record_regions): Delete. | |
2659 | (model_merger::record_svalues): Delete. | |
2660 | (model_merger::m_point): New field. | |
2661 | (model_merger::m_map_regions_from_a_to_m): Delete. | |
2662 | (model_merger::m_map_regions_from_b_to_m): Delete. | |
2663 | (model_merger::m_sid_mapping): Delete. | |
2664 | (struct svalue_id_merger_mapping): Delete. | |
2665 | (class engine): New. | |
2666 | (struct canonicalization): Delete. | |
2667 | (inchash::add): Delete decls for hashing svalue_id and region_id. | |
2668 | (test_region_model_context::on_unexpected_tree_code): Require t to | |
2669 | be non-NULL. | |
2670 | (selftest::assert_condition): Add overload comparing a pair of | |
2671 | const svalue *. | |
2672 | * sm-file.cc: Include "tristate.h", "selftest.h", | |
2673 | "analyzer/call-string.h", "analyzer/program-point.h", | |
2674 | "analyzer/store.h", and "analyzer/region-model.h". | |
2675 | (fileptr_state_machine::get_default_state): New. | |
2676 | (fileptr_state_machine::on_stmt): Remove calls to | |
2677 | get_readable_tree in favor of get_diagnostic_tree. | |
2678 | * sm-malloc.cc: Include "tristate.h", "selftest.h", | |
2679 | "analyzer/call-string.h", "analyzer/program-point.h", | |
2680 | "analyzer/store.h", and "analyzer/region-model.h". | |
2681 | (malloc_state_machine::get_default_state): New. | |
2682 | (malloc_state_machine::reset_when_passed_to_unknown_fn_p): New. | |
2683 | (malloc_diagnostic::describe_state_change): Handle change.m_expr | |
2684 | being NULL. | |
2685 | (null_arg::emit): Avoid printing "NULL '0'". | |
2686 | (null_arg::describe_final_event): Avoid printing "(0) NULL". | |
2687 | (malloc_leak::emit): Handle m_arg being NULL. | |
2688 | (malloc_leak::describe_final_event): Handle ev.m_expr being NULL. | |
2689 | (malloc_state_machine::on_stmt): Don't call get_readable_tree. | |
2690 | Call get_diagnostic_tree when creating pending diagnostics. | |
2691 | Update for is_zero_assignment becoming a member function of | |
2692 | sm_ctxt. | |
2693 | Don't transition to m_non_heap for ADDR_EXPR(MEM_REF()). | |
2694 | (malloc_state_machine::reset_when_passed_to_unknown_fn_p): New | |
2695 | vfunc implementation. | |
2696 | * sm-sensitive.cc (sensitive_state_machine::warn_for_any_exposure): Call | |
2697 | get_diagnostic_tree and pass the result to warn_for_state. | |
2698 | * sm-signal.cc: Move includes of "analyzer/call-string.h" and | |
2699 | "analyzer/program-point.h" to before "analyzer/region-model.h", | |
2700 | and also include "analyzer/store.h" before it. | |
2701 | (signal_unsafe_call::describe_state_change): Use | |
2702 | get_dest_function to get handler. | |
2703 | (update_model_for_signal_handler): Pass manager to region_model | |
2704 | ctor. | |
2705 | (register_signal_handler::impl_transition): Update for changes to | |
2706 | get_or_create_node and add_edge. | |
2707 | * sm-taint.cc (taint_state_machine::on_stmt): Remove calls to | |
2708 | get_readable_tree, replacing them when calling warn_for_state with | |
2709 | calls to get_diagnostic_tree. | |
2710 | * sm.cc (is_zero_assignment): Delete. | |
2711 | (any_pointer_p): Move to within namespace ana. | |
2712 | * sm.h (is_zero_assignment): Remove decl. | |
2713 | (any_pointer_p): Move decl to within namespace ana. | |
2714 | (state_machine::get_default_state): New vfunc. | |
2715 | (state_machine::reset_when_passed_to_unknown_fn_p): New vfunc. | |
2716 | (sm_context::get_readable_tree): Rename to... | |
2717 | (sm_context::get_diagnostic_tree): ...this. | |
2718 | (sm_context::is_zero_assignment): New vfunc. | |
2719 | * store.cc: New file. | |
2720 | * store.h: New file. | |
2721 | * svalue.cc: New file. | |
2722 | ||
2221fb6f MW |
2723 | 2020-05-22 Mark Wielaard <mark@klomp.org> |
2724 | ||
2725 | * sm-signal.cc(signal_unsafe_call::emit): Possibly add | |
2726 | gcc_rich_location note for replacement. | |
2727 | (signal_unsafe_call::get_replacement_fn): New private function. | |
2728 | (get_async_signal_unsafe_fns): Add "exit". | |
2729 | ||
5eae0ac7 DM |
2730 | 2020-04-28 David Malcolm <dmalcolm@redhat.com> |
2731 | ||
2732 | PR analyzer/94816 | |
2733 | * engine.cc (impl_region_model_context::on_unexpected_tree_code): | |
2734 | Handle NULL tree. | |
2735 | * region-model.cc (region_model::add_region_for_type): Handle | |
2736 | NULL type. | |
2737 | * region-model.h | |
2738 | (test_region_model_context::on_unexpected_tree_code): Handle NULL | |
2739 | tree. | |
2740 | ||
78b97837 DM |
2741 | 2020-04-28 David Malcolm <dmalcolm@redhat.com> |
2742 | ||
2743 | PR analyzer/94447 | |
2744 | PR analyzer/94639 | |
2745 | PR analyzer/94732 | |
2746 | PR analyzer/94754 | |
2747 | * analyzer.opt (Wanalyzer-use-of-uninitialized-value): Delete. | |
2748 | * program-state.cc (selftest::test_program_state_dumping): Update | |
2749 | expected dump result for removal of "uninit". | |
2750 | * region-model.cc (poison_kind_to_str): Delete POISON_KIND_UNINIT | |
2751 | case. | |
2752 | (root_region::ensure_stack_region): Initialize stack with null | |
2753 | svalue_id rather than with a typeless POISON_KIND_UNINIT value. | |
2754 | (root_region::ensure_heap_region): Likewise for the heap. | |
2755 | (region_model::dump_summary_of_rep_path_vars): Remove | |
2756 | summarization of uninit values. | |
2757 | (region_model::validate): Remove check that the stack has a | |
2758 | POISON_KIND_UNINIT value. | |
2759 | (poisoned_value_diagnostic::emit): Remove POISON_KIND_UNINIT | |
2760 | case. | |
2761 | (poisoned_value_diagnostic::describe_final_event): Likewise. | |
2762 | (selftest::test_dump): Update expected dump result for removal of | |
2763 | "uninit". | |
2764 | (selftest::test_svalue_equality): Remove "uninit" and "freed". | |
2765 | * region-model.h (enum poison_kind): Remove POISON_KIND_UNINIT. | |
2766 | ||
a96f1c38 DM |
2767 | 2020-04-01 David Malcolm <dmalcolm@redhat.com> |
2768 | ||
2769 | PR analyzer/94378 | |
2770 | * checker-path.cc: Include "bitmap.h". | |
2771 | * constraint-manager.cc: Likewise. | |
2772 | * diagnostic-manager.cc: Likewise. | |
2773 | * engine.cc: Likewise. | |
2774 | (exploded_node::detect_leaks): Pass null region_id to pop_frame. | |
2775 | * program-point.cc: Include "bitmap.h". | |
2776 | * program-state.cc: Likewise. | |
2777 | * region-model.cc (id_set<region_id>::id_set): Convert to... | |
2778 | (region_id_set::region_id_set): ...this. | |
2779 | (svalue_id_set::svalue_id_set): New ctor. | |
2780 | (region_model::copy_region): New function. | |
2781 | (region_model::copy_struct_region): New function. | |
2782 | (region_model::copy_union_region): New function. | |
2783 | (region_model::copy_array_region): New function. | |
2784 | (stack_region::pop_frame): Drop return value. Add | |
2785 | "result_dst_rid" param; if it is non-null, use copy_region to copy | |
2786 | the result to it. Rather than capture and pass a single "known | |
2787 | used" return value to be used by purge_unused_values, instead | |
2788 | gather and pass a set of known used return values. | |
2789 | (root_region::pop_frame): Drop return value. Add "result_dst_rid" | |
2790 | param. | |
2791 | (region_model::on_assignment): Use copy_region. | |
2792 | (region_model::on_return): Likewise for the result. | |
2793 | (region_model::on_longjmp): Pass null for pop_frame's | |
2794 | result_dst_rid. | |
2795 | (region_model::update_for_return_superedge): Pass the region for the | |
2796 | return value of the call, if any, to pop_frame, rather than setting | |
2797 | the lvalue for the lhs of the result. | |
2798 | (region_model::pop_frame): Drop return value. Add | |
2799 | "result_dst_rid" param. | |
2800 | (region_model::purge_unused_svalues): Convert third param from an | |
2801 | svalue_id * to an svalue_id_set *, updating the initial populating | |
2802 | of the "used" bitmap accordingly. Don't remap it when done. | |
2803 | (struct selftest::coord_test): New selftest fixture, extracted from... | |
2804 | (selftest::test_dump_2): ...here. | |
2805 | (selftest::test_compound_assignment): New selftest. | |
2806 | (selftest::test_stack_frames): Pass null to new param of pop_frame. | |
2807 | (selftest::analyzer_region_model_cc_tests): Call the new selftest. | |
2808 | * region-model.h (class id_set): Delete template. | |
2809 | (class region_id_set): Reimplement, using old id_set implementation. | |
2810 | (class svalue_id_set): Likewise. Convert from auto_sbitmap to | |
2811 | auto_bitmap. | |
2812 | (region::get_active_view): New accessor. | |
2813 | (stack_region::pop_frame): Drop return value. Add | |
2814 | "result_dst_rid" param. | |
2815 | (root_region::pop_frame): Likewise. | |
2816 | (region_model::pop_frame): Likewise. | |
2817 | (region_model::copy_region): New decl. | |
2818 | (region_model::purge_unused_svalues): Convert third param from an | |
2819 | svalue_id * to an svalue_id_set *. | |
2820 | (region_model::copy_struct_region): New decl. | |
2821 | (region_model::copy_union_region): New decl. | |
2822 | (region_model::copy_array_region): New decl. | |
2823 | ||
6969ac30 DM |
2824 | 2020-03-27 David Malcolm <dmalcolm@redhat.com> |
2825 | ||
2826 | * program-state.cc (selftest::test_program_state_dumping): Update | |
2827 | expected dump to include symbolic_region's possibly_null field. | |
2828 | * region-model.cc (symbolic_region::print_fields): New vfunc | |
2829 | implementation. | |
2830 | (region_model::add_constraint): Clear m_possibly_null from | |
2831 | symbolic_regions now known to be non-NULL. | |
2832 | (selftest::test_malloc_constraints): New selftest. | |
2833 | (selftest::analyzer_region_model_cc_tests): Call it. | |
2834 | * region-model.h (region::dyn_cast_symbolic_region): Add non-const | |
2835 | overload. | |
2836 | (symbolic_region::dyn_cast_symbolic_region): Implement it. | |
2837 | (symbolic_region::print_fields): New vfunc override decl. | |
2838 | ||
42c63313 DM |
2839 | 2020-03-27 David Malcolm <dmalcolm@redhat.com> |
2840 | ||
2841 | * analyzer.h (class feasibility_problem): New forward decl. | |
2842 | * diagnostic-manager.cc (saved_diagnostic::saved_diagnostic): | |
2843 | Initialize new fields m_status, m_epath_length, and m_problem. | |
2844 | (saved_diagnostic::~saved_diagnostic): Delete m_problem. | |
2845 | (dedupe_candidate::dedupe_candidate): Convert "sd" param from a | |
2846 | const ref to a mutable ptr. | |
2847 | (dedupe_winners::add): Convert "sd" param from a const ref to a | |
2848 | mutable ptr. Record the length of the exploded_path. Record the | |
2849 | feasibility/infeasibility of sd into sd, capturing a | |
2850 | feasibility_problem when feasible_p fails, and storing it in sd. | |
2851 | (diagnostic_manager::emit_saved_diagnostics): Update for pass by | |
2852 | ptr rather than by const ref. | |
2853 | * diagnostic-manager.h (class saved_diagnostic): Add new enum | |
2854 | status. Add fields m_status, m_epath_length and m_problem. | |
2855 | (saved_diagnostic::set_feasible): New member function. | |
2856 | (saved_diagnostic::set_infeasible): New member function. | |
2857 | (saved_diagnostic::get_feasibility_problem): New accessor. | |
2858 | (saved_diagnostic::get_status): New accessor. | |
2859 | (saved_diagnostic::set_epath_length): New member function. | |
2860 | (saved_diagnostic::get_epath_length): New accessor. | |
2861 | * engine.cc: Include "gimple-pretty-print.h". | |
2862 | (exploded_path::feasible_p): Add OUT param and, if non-NULL, write | |
2863 | a new feasibility_problem to it on failure. | |
2864 | (viz_callgraph_node::dump_dot): Convert begin_tr calls to | |
2865 | begin_trtd. Convert end_tr calls to end_tdtr. | |
2866 | (class exploded_graph_annotator): New subclass of dot_annotator. | |
2867 | (impl_run_checkers): Add a second -fdump-analyzer-supergraph dump | |
2868 | after the analysis runs, using exploded_graph_annotator. dumping | |
2869 | to DUMP_BASE_NAME.supergraph-eg.dot. | |
2870 | * exploded-graph.h (exploded_node::get_dot_fillcolor): Make | |
2871 | public. | |
2872 | (exploded_path::feasible_p): Add OUT param. | |
2873 | (class feasibility_problem): New class. | |
2874 | * state-purge.cc (state_purge_annotator::add_node_annotations): | |
2875 | Return a bool, add a "within_table" param. | |
2876 | (print_vec_of_names): Convert begin_tr calls to begin_trtd. | |
2877 | Convert end_tr calls to end_tdtr. | |
2878 | (state_purge_annotator::add_stmt_annotations): Add "within_row" | |
2879 | param. | |
2880 | * state-purge.h ((state_purge_annotator::add_node_annotations): | |
2881 | Return a bool, add a "within_table" param. | |
2882 | (state_purge_annotator::add_stmt_annotations): Add "within_row" | |
2883 | param. | |
2884 | * supergraph.cc (supernode::dump_dot): Call add_node_annotations | |
2885 | twice: as before, passing false for "within_table", then again | |
2886 | with true when within the TABLE element. Convert some begin_tr | |
2887 | calls to begin_trtd, and some end_tr calls to end_tdtr. | |
2888 | Repeat each add_stmt_annotations call, distinguishing between | |
2889 | calls that add TRs and those that add TDs to an existing TR. | |
2890 | Add a call to add_after_node_annotations. | |
2891 | * supergraph.h (dot_annotator::add_node_annotations): Add a | |
2892 | "within_table" param. | |
2893 | (dot_annotator::add_stmt_annotations): Add a "within_row" param. | |
2894 | (dot_annotator::add_after_node_annotations): New vfunc. | |
2895 | ||
8f023575 DM |
2896 | 2020-03-27 David Malcolm <dmalcolm@redhat.com> |
2897 | ||
2898 | * diagnostic-manager.cc (dedupe_winners::add): Show the | |
2899 | exploded_node index in the log messages. | |
2900 | (diagnostic_manager::emit_saved_diagnostics): Log a summary of | |
2901 | m_saved_diagnostics at entry. | |
2902 | ||
4d661bb7 DM |
2903 | 2020-03-27 David Malcolm <dmalcolm@redhat.com> |
2904 | ||
2905 | * supergraph.cc (superedge::dump): Add space before description; | |
2906 | move newline to non-pretty_printer overload. | |
2907 | ||
884d9141 DM |
2908 | 2020-03-18 David Malcolm <dmalcolm@redhat.com> |
2909 | ||
2910 | * region-model.cc: Include "stor-layout.h". | |
2911 | (region_model::dump_to_pp): Rather than calling | |
2912 | dump_summary_of_map on each of the current frame and the globals, | |
2913 | instead get a vec of representative path_vars for all regions, | |
2914 | and then dump a summary of all of them. | |
2915 | (region_model::dump_summary_of_map): Delete, rewriting into... | |
2916 | (region_model::dump_summary_of_rep_path_vars): ...this new | |
2917 | function, working on a vec of path_vars. | |
2918 | (region_model::set_value): New overload. | |
2919 | (region_model::get_representative_path_var): Rename | |
2920 | "parent_region" local to "parent_reg" and consolidate with other | |
2921 | local. Guard test for grandparent being stack on parent_reg being | |
2922 | non-NULL. Move handling for parent being an array_region to | |
2923 | within guard for parent_reg being non-NULL. | |
2924 | (selftest::make_test_compound_type): New function. | |
2925 | (selftest::test_dump_2): New selftest. | |
2926 | (selftest::test_dump_3): New selftest. | |
2927 | (selftest::test_stack_frames): Update expected output from | |
2928 | simplified dump to show "a" and "b" from parent frame and "y" in | |
2929 | child frame. | |
2930 | (selftest::analyzer_region_model_cc_tests): Call test_dump_2 and | |
2931 | test_dump_3. | |
2932 | * region-model.h (region_model::set_value): New overload decl. | |
2933 | (region_model::dump_summary_of_map): Delete. | |
2934 | (region_model::dump_summary_of_rep_path_vars): New. | |
2935 | ||
7d9c107a DM |
2936 | 2020-03-18 David Malcolm <dmalcolm@redhat.com> |
2937 | ||
2938 | * region-model.h (class noop_region_model_context): New subclass | |
2939 | of region_model_context. | |
2940 | (class tentative_region_model_context): Inherit from | |
2941 | noop_region_model_context rather than from region_model_context; | |
2942 | drop redundant vfunc implementations. | |
2943 | (class test_region_model_context): Likewise. | |
2944 | ||
0db2cd17 DM |
2945 | 2020-03-18 David Malcolm <dmalcolm@redhat.com> |
2946 | ||
2947 | * engine.cc (exploded_node::exploded_node): Move implementation | |
2948 | here from header; accept point_and_state by const reference rather | |
2949 | than by value. | |
2950 | * exploded-graph.h (exploded_node::exploded_node): Pass | |
2951 | point_and_state by const reference rather than by value. Move | |
2952 | body to engine.cc. | |
2953 | ||
d5029d45 JJ |
2954 | 2020-03-18 Jakub Jelinek <jakub@redhat.com> |
2955 | ||
2956 | * sm-malloc.cc (malloc_state_machine::on_stmt): Fix up duplicated word | |
2957 | issue in a comment. | |
2958 | * region-model.cc (region_model::make_region_for_unexpected_tree_code, | |
2959 | region_model::delete_region_and_descendents): Likewise. | |
2960 | * engine.cc (class exploded_cluster): Likewise. | |
2961 | * diagnostic-manager.cc (class path_builder): Likewise. | |
2962 | ||
5c048755 DM |
2963 | 2020-03-13 David Malcolm <dmalcolm@redhat.com> |
2964 | ||
2965 | PR analyzer/94099 | |
2966 | PR analyzer/94105 | |
2967 | * diagnostic-manager.cc (for_each_state_change): Bulletproof | |
2968 | against errors in get_rvalue by passing a | |
2969 | tentative_region_model_context and rejecting if there's an error. | |
2970 | * region-model.cc (region_model::get_lvalue_1): When handling | |
2971 | ARRAY_REF, handle results of error-handling. Handle NOP_EXPR. | |
2972 | ||
90f7c300 DM |
2973 | 2020-03-06 David Malcolm <dmalcolm@redhat.com> |
2974 | ||
2975 | * analyzer.h (class array_region): New forward decl. | |
2976 | * program-state.cc (selftest::test_program_state_dumping_2): New. | |
2977 | (selftest::analyzer_program_state_cc_tests): Call it. | |
2978 | * region-model.cc (array_region::constant_from_key): New. | |
2979 | (region_model::get_representative_tree): Handle region_svalue by | |
2980 | generating an ADDR_EXPR. | |
2981 | (region_model::get_representative_path_var): In view handling, | |
2982 | remove erroneous TREE_TYPE when determining the type of the tree. | |
2983 | Handle array regions and STRING_CST. | |
2984 | (selftest::assert_dump_tree_eq): New. | |
2985 | (ASSERT_DUMP_TREE_EQ): New macro. | |
2986 | (selftest::test_get_representative_tree): New selftest. | |
2987 | (selftest::analyzer_region_model_cc_tests): Call it. | |
2988 | * region-model.h (region::dyn_cast_array_region): New vfunc. | |
2989 | (array_region::dyn_cast_array_region): New vfunc implementation. | |
2990 | (array_region::constant_from_key): New decl. | |
2991 | ||
41f99ba6 DM |
2992 | 2020-03-06 David Malcolm <dmalcolm@redhat.com> |
2993 | ||
2994 | * analyzer.h (dump_quoted_tree): New decl. | |
2995 | * engine.cc (exploded_node::dump_dot): Pass region model to | |
2996 | sm_state_map::print. | |
2997 | * program-state.cc: Include diagnostic-core.h. | |
2998 | (sm_state_map::print): Add "model" param and use it to print | |
2999 | representative trees. Only print origin information if non-null. | |
3000 | (sm_state_map::dump): Pass NULL for model to print call. | |
3001 | (program_state::print): Pass region model to sm_state_map::print. | |
3002 | (program_state::dump_to_pp): Use spaces rather than newlines when | |
3003 | summarizing. Pass region_model to sm_state_map::print. | |
3004 | (ana::selftest::assert_dump_eq): New function. | |
3005 | (ASSERT_DUMP_EQ): New macro. | |
3006 | (ana::selftest::test_program_state_dumping): New function. | |
3007 | (ana::selftest::analyzer_program_state_cc_tests): Call it. | |
3008 | * program-state.h (program_state::print): Add model param. | |
3009 | * region-model.cc (dump_quoted_tree): New function. | |
3010 | (map_region::print_fields): Use dump_quoted_tree rather than | |
3011 | %qE to avoid lang-dependent output. | |
3012 | (map_region::dump_child_label): Likewise. | |
3013 | (region_model::dump_summary_of_map): For SK_REGION, when | |
3014 | get_representative_path_var fails, print the region id rather than | |
3015 | erroneously printing NULL. | |
3016 | * sm.cc (state_machine::get_state_by_name): New function. | |
3017 | * sm.h (state_machine::get_state_by_name): New decl. | |
3018 | ||
3c1645a3 DM |
3019 | 2020-03-04 David Malcolm <dmalcolm@redhat.com> |
3020 | ||
3021 | * region-model.cc (region::validate): Convert model param from ptr | |
3022 | to reference. Update comment to reflect that it's now a vfunc. | |
3023 | (map_region::validate): New vfunc implementation. | |
3024 | (array_region::validate): New vfunc implementation. | |
3025 | (stack_region::validate): New vfunc implementation. | |
3026 | (root_region::validate): New vfunc implementation. | |
3027 | (region_model::validate): Pass a reference rather than a pointer | |
3028 | to the region::validate vfunc. | |
3029 | * region-model.h (region::validate): Make virtual. Convert model | |
3030 | param from ptr to reference. | |
3031 | (map_region::validate): New vfunc decl. | |
3032 | (array_region::validate): New vfunc decl. | |
3033 | (stack_region::validate): New vfunc decl. | |
3034 | (root_region::validate): New vfunc decl. | |
3035 | ||
e516294a DM |
3036 | 2020-03-04 David Malcolm <dmalcolm@redhat.com> |
3037 | ||
3038 | PR analyzer/93993 | |
3039 | * region-model.cc (region_model::on_call_pre): Handle | |
3040 | BUILT_IN_EXPECT and its variants. | |
3041 | (region_model::add_any_constraints_from_ssa_def_stmt): Split out | |
3042 | gassign handling into add_any_constraints_from_gassign; add gcall | |
3043 | handling. | |
3044 | (region_model::add_any_constraints_from_gassign): New function, | |
3045 | based on the above. Add handling for NOP_EXPR. | |
3046 | (region_model::add_any_constraints_from_gcall): New function. | |
3047 | (region_model::get_representative_path_var): Handle views. | |
3048 | * region-model.h | |
3049 | (region_model::add_any_constraints_from_ssa_def_stmt): New decl. | |
3050 | (region_model::add_any_constraints_from_gassign): New decl. | |
3051 | ||
3d66e153 DM |
3052 | 2020-03-04 David Malcolm <dmalcolm@redhat.com> |
3053 | ||
3054 | PR analyzer/93993 | |
3055 | * checker-path.h (state_change_event::get_lvalue): Add ctxt param | |
3056 | and pass it to region_model::get_value call. | |
3057 | * diagnostic-manager.cc (get_any_origin): Pass a | |
3058 | tentative_region_model_context to the calls to get_lvalue and reject | |
3059 | the comparison if errors occur. | |
3060 | (can_be_expr_of_interest_p): New function. | |
3061 | (diagnostic_manager::prune_for_sm_diagnostic): Replace checks for | |
3062 | CONSTANT_CLASS_P with calls to update_for_unsuitable_sm_exprs. | |
3063 | Pass a tentative_region_model_context to the calls to | |
3064 | state_change_event::get_lvalue and reject the comparison if errors | |
3065 | occur. | |
3066 | (diagnostic_manager::update_for_unsuitable_sm_exprs): New. | |
3067 | * diagnostic-manager.h | |
3068 | (diagnostic_manager::update_for_unsuitable_sm_exprs): New decl. | |
3069 | * region-model.h (class tentative_region_model_context): New class. | |
3070 | ||
13e3ba14 DM |
3071 | 2020-03-04 David Malcolm <dmalcolm@redhat.com> |
3072 | ||
3073 | * engine.cc (worklist::worklist): Remove unused field m_eg. | |
3074 | (class viz_callgraph_edge): Remove unused field m_call_sedge. | |
3075 | (class viz_callgraph): Remove unused field m_sg. | |
3076 | * exploded-graph.h (worklist::::m_eg): Remove unused field. | |
3077 | ||
13b76912 DM |
3078 | 2020-03-02 David Malcolm <dmalcolm@redhat.com> |
3079 | ||
3080 | * analyzer.opt (fanalyzer-show-duplicate-count): New option. | |
3081 | * diagnostic-manager.cc | |
3082 | (diagnostic_manager::emit_saved_diagnostic): Use the above to | |
3083 | guard the printing of the duplicate count. | |
3084 | ||
9f00b22f DM |
3085 | 2020-03-02 David Malcolm <dmalcolm@redhat.com> |
3086 | ||
3087 | PR analyzer/93959 | |
3088 | * analyzer.cc (is_std_function_p): New function. | |
3089 | (is_std_named_call_p): New functions. | |
3090 | * analyzer.h (is_std_named_call_p): New decl. | |
3091 | * sm-malloc.cc (malloc_state_machine::on_stmt): Check for "std::" | |
3092 | variants when checking for malloc, calloc and free. | |
3093 | ||
71b633aa DM |
3094 | 2020-02-26 David Malcolm <dmalcolm@redhat.com> |
3095 | ||
3096 | PR analyzer/93950 | |
3097 | * diagnostic-manager.cc | |
3098 | (diagnostic_manager::prune_for_sm_diagnostic): Assert that var is | |
3099 | either NULL or not a constant. When updating var, bulletproof | |
3100 | against constant values. | |
3101 | ||
0ba70d1b DM |
3102 | 2020-02-26 David Malcolm <dmalcolm@redhat.com> |
3103 | ||
3104 | PR analyzer/93947 | |
3105 | * region-model.cc (region_model::get_fndecl_for_call): Gracefully | |
3106 | fail for fn_decls that don't have a cgraph_node. | |
3107 | ||
67fa274c DM |
3108 | 2020-02-26 David Malcolm <dmalcolm@redhat.com> |
3109 | ||
3110 | * bar-chart.cc: New file. | |
3111 | * bar-chart.h: New file. | |
3112 | * engine.cc: Include "analyzer/bar-chart.h". | |
3113 | (stats::log): Only log the m_num_nodes kinds that are non-zero. | |
3114 | (stats::dump): Likewise when dumping. | |
3115 | (stats::get_total_enodes): New. | |
3116 | (exploded_graph::get_or_create_node): Increment the per-point-data | |
3117 | m_excess_enodes when hitting the per-program-point limit on | |
3118 | enodes. | |
3119 | (exploded_graph::print_bar_charts): New. | |
3120 | (exploded_graph::log_stats): Log the number of unprocessed enodes | |
3121 | in the worklist. Call print_bar_charts. | |
3122 | (exploded_graph::dump_stats): Print the number of unprocessed | |
3123 | enodes in the worklist. | |
3124 | * exploded-graph.h (stats::get_total_enodes): New decl. | |
3125 | (struct per_program_point_data): Add field m_excess_enodes. | |
3126 | (exploded_graph::print_bar_charts): New decl. | |
3127 | * supergraph.cc (superedge::dump): New. | |
3128 | (superedge::dump): New. | |
3129 | * supergraph.h (supernode::get_function): New. | |
3130 | (superedge::dump): New decl. | |
3131 | (superedge::dump): New decl. | |
3132 | ||
f2ca2088 DM |
3133 | 2020-02-24 David Malcolm <dmalcolm@redhat.com> |
3134 | ||
3135 | * engine.cc (exploded_graph::get_or_create_node): Dump the | |
3136 | program_state to the pp, rather than to stderr. | |
3137 | ||
b3d788a2 DM |
3138 | 2020-02-24 David Malcolm <dmalcolm@redhat.com> |
3139 | ||
3140 | PR analyzer/93032 | |
3141 | * sm.cc (make_checkers): Require the "taint" checker to be | |
3142 | explicitly enabled. | |
3143 | ||
3a25f345 DM |
3144 | 2020-02-24 David Malcolm <dmalcolm@redhat.com> |
3145 | ||
3146 | PR analyzer/93899 | |
3147 | * engine.cc | |
3148 | (impl_region_model_context::impl_region_model_context): Add logger | |
3149 | param. | |
3150 | * engine.cc (exploded_graph::add_function_entry): Create an | |
3151 | impl_region_model_context and pass it to the push_frame call. | |
3152 | Bail if the resulting state is invalid. | |
3153 | (exploded_graph::build_initial_worklist): Likewise. | |
3154 | (exploded_graph::build_initial_worklist): Handle the case where | |
3155 | add_function_entry fails. | |
3156 | * exploded-graph.h | |
3157 | (impl_region_model_context::impl_region_model_context): Add logger | |
3158 | param. | |
3159 | * region-model.cc (map_region::get_or_create): Add ctxt param and | |
3160 | pass it to add_region_for_type. | |
3161 | (map_region::can_merge_p): Pass NULL as a ctxt to call to | |
3162 | get_or_create. | |
3163 | (array_region::get_element): Pass ctxt to call to get_or_create. | |
3164 | (array_region::get_or_create): Add ctxt param and pass it to | |
3165 | add_region_for_type. | |
3166 | (root_region::push_frame): Pass ctxt to get_or_create calls. | |
3167 | (region_model::get_lvalue_1): Likewise. | |
3168 | (region_model::make_region_for_unexpected_tree_code): Assert that | |
3169 | ctxt is non-NULL. | |
3170 | (region_model::get_rvalue_1): Pass ctxt to get_svalue_for_fndecl | |
3171 | and get_svalue_for_label calls. | |
3172 | (region_model::get_svalue_for_fndecl): Add ctxt param and pass it | |
3173 | to get_region_for_fndecl. | |
3174 | (region_model::get_region_for_fndecl): Add ctxt param and pass it | |
3175 | to get_or_create. | |
3176 | (region_model::get_svalue_for_label): Add ctxt param and pass it | |
3177 | to get_region_for_label. | |
3178 | (region_model::get_region_for_label): Add ctxt param and pass it | |
3179 | to get_region_for_fndecl and get_or_create. | |
3180 | (region_model::get_field_region): Add ctxt param and pass it to | |
3181 | get_or_create_view and get_or_create. | |
3182 | (make_region_for_type): Replace gcc_unreachable with return NULL. | |
3183 | (region_model::add_region_for_type): Add ctxt param. Handle a | |
3184 | return of NULL from make_region_for_type by calling | |
3185 | make_region_for_unexpected_tree_code. | |
3186 | (region_model::get_or_create_mem_ref): Pass ctxt to calls to | |
3187 | get_or_create_view. | |
3188 | (region_model::get_or_create_view): Add ctxt param and pass it to | |
3189 | add_region_for_type. | |
3190 | (selftest::test_state_merging): Pass ctxt to get_or_create_view. | |
3191 | * region-model.h (region_model::get_or_create): Add ctxt param. | |
3192 | (region_model::add_region_for_type): Likewise. | |
3193 | (region_model::get_svalue_for_fndecl): Likewise. | |
3194 | (region_model::get_svalue_for_label): Likewise. | |
3195 | (region_model::get_region_for_fndecl): Likewise. | |
3196 | (region_model::get_region_for_label): Likewise. | |
3197 | (region_model::get_field_region): Likewise. | |
3198 | (region_model::get_or_create_view): Likewise. | |
3199 | ||
004f2c07 DM |
3200 | 2020-02-24 David Malcolm <dmalcolm@redhat.com> |
3201 | ||
3202 | * checker-path.cc (superedge_event::should_filter_p): Update | |
3203 | filter for empty descriptions to cover verbosity level 3 as well | |
3204 | as 2. | |
3205 | * diagnostic-manager.cc: Include "analyzer/reachability.h". | |
3206 | (class path_builder): New class. | |
3207 | (diagnostic_manager::emit_saved_diagnostic): Create a path_builder | |
3208 | and pass it to build_emission_path, rather passing eg; similarly | |
3209 | for add_events_for_eedge and ext_state. | |
3210 | (diagnostic_manager::build_emission_path): Replace "eg" param | |
3211 | with a path_builder, pass it to add_events_for_eedge. | |
3212 | (diagnostic_manager::add_events_for_eedge): Replace ext_state | |
3213 | param with path_builder; pass it to add_events_for_superedge. | |
3214 | (diagnostic_manager::significant_edge_p): New. | |
3215 | (diagnostic_manager::add_events_for_superedge): Add path_builder | |
3216 | param. Reject insignificant edges at verbosity levels below 3. | |
3217 | (diagnostic_manager::prune_for_sm_diagnostic): Update highest | |
3218 | verbosity level to 4. | |
3219 | * diagnostic-manager.h (class path_builder): New forward decl. | |
3220 | (diagnostic_manager::build_emission_path): Replace "eg" param | |
3221 | with a path_builder. | |
3222 | (diagnostic_manager::add_events_for_eedge): Replace ext_state | |
3223 | param with path_builder. | |
3224 | (diagnostic_manager::significant_edge_p): New. | |
3225 | (diagnostic_manager::add_events_for_superedge): Add path_builder | |
3226 | param. | |
3227 | * reachability.h: New file. | |
3228 | ||
0b2b45a6 DM |
3229 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
3230 | ||
3231 | PR analyzer/93692 | |
3232 | * analyzer.opt (fdump-analyzer-callgraph): Rewrite description. | |
3233 | ||
4f40164a DM |
3234 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
3235 | ||
3236 | PR analyzer/93777 | |
3237 | * region-model.cc (region_model::maybe_cast_1): Replace assertion | |
3238 | that build_cast returns non-NULL with a conditional, falling | |
3239 | through to the logic which returns a new unknown value of the | |
3240 | desired type if it fails. | |
3241 | ||
2e623393 DM |
3242 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
3243 | ||
3244 | PR analyzer/93778 | |
3245 | * engine.cc (impl_region_model_context::on_unknown_tree_code): | |
3246 | Rename to... | |
3247 | (impl_region_model_context::on_unexpected_tree_code): ...this and | |
3248 | convert first argument from path_var to tree. | |
3249 | (exploded_node::on_stmt): Pass ctxt to purge_for_unknown_fncall. | |
3250 | * exploded-graph.h (region_model_context::on_unknown_tree_code): | |
3251 | Rename to... | |
3252 | (region_model_context::on_unexpected_tree_code): ...this and | |
3253 | convert first argument from path_var to tree. | |
3254 | * program-state.cc (sm_state_map::purge_for_unknown_fncall): Add | |
3255 | ctxt param and pass on to calls to get_rvalue. | |
3256 | * program-state.h (sm_state_map::purge_for_unknown_fncall): Add | |
3257 | ctxt param. | |
3258 | * region-model.cc (region_model::handle_unrecognized_call): Pass | |
3259 | ctxt on to call to get_rvalue. | |
3260 | (region_model::get_lvalue_1): Move body of default case to | |
3261 | region_model::make_region_for_unexpected_tree_code and call it. | |
3262 | Within COMPONENT_REF case, reject attempts to handle types other | |
3263 | than RECORD_TYPE and UNION_TYPE. | |
3264 | (region_model::make_region_for_unexpected_tree_code): New | |
3265 | function, based on default case of region_model::get_lvalue_1. | |
3266 | * region-model.h | |
3267 | (region_model::make_region_for_unexpected_tree_code): New decl. | |
3268 | (region_model::on_unknown_tree_code): Rename to... | |
3269 | (region_model::on_unexpected_tree_code): ...this and convert first | |
3270 | argument from path_var to tree. | |
3271 | (class test_region_model_context): Update vfunc implementation for | |
3272 | above change. | |
3273 | ||
a674c7b8 DM |
3274 | 2020-02-18 David Malcolm <dmalcolm@redhat.com> |
3275 | ||
3276 | PR analyzer/93774 | |
3277 | * region-model.cc | |
3278 | (region_model::convert_byte_offset_to_array_index): Use | |
3279 | int_size_in_bytes before calling size_in_bytes, to gracefully fail | |
3280 | on incomplete types. | |
3281 | ||
d8cde6f9 DM |
3282 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
3283 | ||
3284 | PR analyzer/93775 | |
3285 | * region-model.cc (region_model::get_fndecl_for_call): Handle the | |
3286 | case where the code_region's get_tree_for_child_region returns | |
3287 | NULL. | |
3288 | ||
f76a88eb DM |
3289 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
3290 | ||
3291 | PR analyzer/93388 | |
3292 | * engine.cc (impl_region_model_context::on_unknown_tree_code): | |
3293 | New. | |
3294 | (exploded_graph::get_or_create_node): Reject invalid states. | |
3295 | * exploded-graph.h | |
3296 | (impl_region_model_context::on_unknown_tree_code): New decl. | |
3297 | (point_and_state::point_and_state): Assert that the state is | |
3298 | valid. | |
3299 | * program-state.cc (program_state::program_state): Initialize | |
3300 | m_valid to true. | |
3301 | (program_state::operator=): Copy m_valid. | |
3302 | (program_state::program_state): Likewise for move constructor. | |
3303 | (program_state::print): Print m_valid. | |
3304 | (program_state::dump_to_pp): Likewise. | |
3305 | * program-state.h (program_state::m_valid): New field. | |
3306 | * region-model.cc (region_model::get_lvalue_1): Implement the | |
3307 | default case by returning a new symbolic region and calling | |
3308 | the context's on_unknown_tree_code, rather than issuing an | |
3309 | internal_error. Implement VIEW_CONVERT_EXPR. | |
3310 | * region-model.h (region_model_context::on_unknown_tree_code): New | |
3311 | vfunc. | |
3312 | (test_region_model_context::on_unknown_tree_code): New. | |
3313 | ||
0993ad65 DM |
3314 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
3315 | ||
3316 | * sm-malloc.cc (malloc_diagnostic::describe_state_change): For | |
3317 | transition to the "null" state, only say "assuming" when | |
3318 | transitioning from the "unchecked" state. | |
3319 | ||
67098787 DM |
3320 | 2020-02-17 David Malcolm <dmalcolm@redhat.com> |
3321 | ||
3322 | * diagnostic-manager.h (diagnostic_manager::get_saved_diagnostic): | |
3323 | Add const overload. | |
3324 | * engine.cc (exploded_node::dump_dot): Dump saved_diagnostics. | |
3325 | * exploded-graph.h (exploded_graph::get_diagnostic_manager): Add | |
3326 | const overload. | |
3327 | ||
91f993b7 DM |
3328 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
3329 | ||
3330 | PR analyzer/93288 | |
3331 | * analysis-plan.cc (analysis_plan::use_summary_p): Look through | |
3332 | the ultimate_alias_target when getting the called function. | |
3333 | * engine.cc (exploded_node::on_stmt): Rename second "ctxt" to | |
3334 | "sm_ctxt". Use the region_model's get_fndecl_for_call rather than | |
3335 | gimple_call_fndecl. | |
3336 | * region-model.cc (region_model::get_fndecl_for_call): Use | |
3337 | ultimate_alias_target on fndecl. | |
3338 | * supergraph.cc (get_ultimate_function_for_cgraph_edge): New | |
3339 | function. | |
3340 | (supergraph_call_edge): Use it when rejecting edges without | |
3341 | functions. | |
3342 | (supergraph::supergraph): Use it to get the function for the | |
3343 | cgraph_edge when building interprocedural superedges. | |
3344 | (callgraph_superedge::get_callee_function): Use it. | |
3345 | * supergraph.h (supergraph::get_num_snodes): Make param const. | |
3346 | (supergraph::function_to_num_snodes_t): Make first type param | |
3347 | const. | |
3348 | ||
a60d9889 DM |
3349 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
3350 | ||
3351 | PR analyzer/93374 | |
3352 | * engine.cc (exploded_edge::exploded_edge): Add ext_state param | |
3353 | and pass it to change.validate. | |
3354 | (exploded_graph::get_or_create_node): Move purging of change | |
3355 | svalues to also cover the case of reusing an existing enode. | |
3356 | (exploded_graph::add_edge): Pass m_ext_state to exploded_edge's | |
3357 | ctor. | |
3358 | * exploded-graph.h (exploded_edge::exploded_edge): Add ext_state | |
3359 | param. | |
3360 | * program-state.cc (state_change::sm_change::validate): Likewise. | |
3361 | Assert that m_sm_idx is sane. Use ext_state to validate | |
3362 | m_old_state and m_new_state. | |
3363 | (state_change::validate): Add ext_state param and pass it to | |
3364 | the sm_change validate calls. | |
3365 | * program-state.h (state_change::sm_change::validate): Add | |
3366 | ext_state param. | |
3367 | (state_change::validate): Likewise. | |
3368 | ||
a0e4929b DM |
3369 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
3370 | ||
3371 | PR analyzer/93669 | |
3372 | * engine.cc (exploded_graph::dump_exploded_nodes): Handle missing | |
3373 | case of STATUS_WORKLIST in implementation of | |
3374 | "__analyzer_dump_exploded_nodes". | |
3375 | ||
cd28b759 DM |
3376 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
3377 | ||
3378 | PR analyzer/93649 | |
3379 | * constraint-manager.cc (constraint_manager::add_constraint): When | |
3380 | merging equivalence classes and updating m_constant, also update | |
3381 | m_cst_sid. | |
3382 | (constraint_manager::validate): If m_constant is non-NULL assert | |
3383 | that m_cst_sid is non-null and is valid. | |
3384 | ||
5e17c1bd DM |
3385 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
3386 | ||
3387 | PR analyzer/93657 | |
3388 | * analyzer.opt (fdump-analyzer): Reword description. | |
3389 | (fdump-analyzer-stderr): Likewise. | |
3390 | ||
c46d057f DM |
3391 | 2020-02-11 David Malcolm <dmalcolm@redhat.com> |
3392 | ||
3393 | * region-model.cc (print_quoted_type): New function. | |
3394 | (svalue::print): Use it to replace %qT. | |
3395 | (region::dump_to_pp): Likewise. | |
3396 | (region::dump_child_label): Likewise. | |
3397 | (region::print_fields): Likewise. | |
3398 | ||
eb031d4b DM |
3399 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
3400 | ||
3401 | PR analyzer/93659 | |
3402 | * analyzer.opt (-param=analyzer-max-recursion-depth=): Fix "tha" | |
3403 | -> "that" typo. | |
3404 | (Wanalyzer-use-of-uninitialized-value): Fix "initialized" -> | |
3405 | "uninitialized" typo. | |
3406 | ||
e87deb37 DM |
3407 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
3408 | ||
3409 | PR analyzer/93350 | |
3410 | * region-model.cc (region_model::get_lvalue_1): | |
3411 | Handle BIT_FIELD_REF. | |
3412 | (make_region_for_type): Handle VECTOR_TYPE. | |
3413 | ||
e953f958 DM |
3414 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
3415 | ||
3416 | PR analyzer/93647 | |
3417 | * diagnostic-manager.cc | |
3418 | (diagnostic_manager::prune_for_sm_diagnostic): Bulletproof against | |
3419 | VAR being constant. | |
3420 | * region-model.cc (region_model::get_lvalue_1): Provide a better | |
3421 | error message when encountering an unhandled tree code. | |
3422 | ||
41a9e940 DM |
3423 | 2020-02-10 David Malcolm <dmalcolm@redhat.com> |
3424 | ||
3425 | PR analyzer/93405 | |
3426 | * region-model.cc (region_model::get_lvalue_1): Implement | |
3427 | CONST_DECL. | |
3428 | ||
cb273d81 DM |
3429 | 2020-02-06 David Malcolm <dmalcolm@redhat.com> |
3430 | ||
3431 | * region-model.cc (region_model::maybe_cast_1): Attempt to provide | |
3432 | a region_svalue if either type is a pointer, rather than if both | |
3433 | types are pointers. | |
3434 | ||
a4d3bfc0 DM |
3435 | 2020-02-05 David Malcolm <dmalcolm@redhat.com> |
3436 | ||
3437 | * engine.cc (exploded_node::dump_dot): Show merger enodes. | |
3438 | (worklist::add_node): Assert that the node's m_status is | |
3439 | STATUS_WORKLIST. | |
3440 | (exploded_graph::process_worklist): Likewise for nodes from the | |
3441 | worklist. Set status of merged nodes to STATUS_MERGER. | |
3442 | (exploded_graph::process_node): Set status of node to | |
3443 | STATUS_PROCESSED. | |
3444 | (exploded_graph::dump_exploded_nodes): Rework handling of | |
3445 | "__analyzer_dump_exploded_nodes", splitting enodes by status into | |
3446 | "processed" and "merger", showing the count of just the processed | |
3447 | enodes at the call, rather than the count of all enodes. | |
3448 | * exploded-graph.h (exploded_node::status): New enum. | |
3449 | (exploded_node::exploded_node): Initialize m_status to | |
3450 | STATUS_WORKLIST. | |
3451 | (exploded_node::get_status): New getter. | |
3452 | (exploded_node::set_status): New setter. | |
3453 | ||
1dae549d DM |
3454 | 2020-02-04 David Malcolm <dmalcolm@redhat.com> |
3455 | ||
3456 | PR analyzer/93543 | |
3457 | * engine.cc (pod_hash_traits<function_call_string>::mark_empty): | |
3458 | Eliminate reinterpret_cast. | |
3459 | (pod_hash_traits<function_call_string>::is_empty): Likewise. | |
3460 | ||
833f1e66 DM |
3461 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
3462 | ||
3463 | * constraint-manager.cc (range::constrained_to_single_element): | |
3464 | Replace fold_build2 with fold_binary. Remove unnecessary newline. | |
3465 | (constraint_manager::get_or_add_equiv_class): Replace fold_build2 | |
3466 | with fold_binary in two places, and remove out-of-date comment. | |
3467 | (constraint_manager::eval_condition): Replace fold_build2 with | |
3468 | fold_binary. | |
3469 | * region-model.cc (constant_svalue::eval_condition): Likewise. | |
3470 | (region_model::on_assignment): Likewise. | |
3471 | ||
8525d1f5 DM |
3472 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
3473 | ||
3474 | PR analyzer/93544 | |
3475 | * diagnostic-manager.cc | |
3476 | (diagnostic_manager::prune_for_sm_diagnostic): Bulletproof | |
3477 | against bad choices due to bad paths. | |
3478 | * engine.cc (impl_region_model_context::on_phi): New. | |
3479 | * exploded-graph.h (impl_region_model_context::on_phi): New decl. | |
3480 | * region-model.cc (region_model::on_longjmp): Likewise. | |
3481 | (region_model::handle_phi): Add phi param. Call the ctxt's on_phi | |
3482 | vfunc. | |
3483 | (region_model::update_for_phis): Pass phi to handle_phi. | |
3484 | * region-model.h (region_model::handle_phi): Add phi param. | |
3485 | (region_model_context::on_phi): New vfunc. | |
3486 | (test_region_model_context::on_phi): New. | |
3487 | * sm-malloc.cc (malloc_state_machine::on_phi): New. | |
3488 | (malloc_state_machine::on_zero_assignment): New. | |
3489 | * sm.h (state_machine::on_phi): New vfunc. | |
3490 | ||
73f38658 DM |
3491 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
3492 | ||
3493 | * engine.cc (supernode_cluster::dump_dot): Show BB index as | |
3494 | well as SN index. | |
3495 | * supergraph.cc (supernode::dump_dot): Likewise. | |
3496 | ||
5e10b9a2 DM |
3497 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
3498 | ||
3499 | PR analyzer/93546 | |
3500 | * region-model.cc (region_model::on_call_pre): Update for new | |
3501 | param of symbolic_region ctor. | |
3502 | (region_model::deref_rvalue): Likewise. | |
3503 | (region_model::add_new_malloc_region): Likewise. | |
3504 | (make_region_for_type): Likewise, preserving type. | |
3505 | * region-model.h (symbolic_region::symbolic_region): Add "type" | |
3506 | param and pass it to base class ctor. | |
3507 | ||
287ccd3b DM |
3508 | 2020-02-03 David Malcolm <dmalcolm@redhat.com> |
3509 | ||
3510 | PR analyzer/93547 | |
3511 | * constraint-manager.cc | |
3512 | (constraint_manager::get_or_add_equiv_class): Ensure types are | |
3513 | compatible before comparing constants. | |
3514 | ||
67751724 DM |
3515 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
3516 | ||
3517 | PR analyzer/93457 | |
3518 | * region-model.cc (make_region_for_type): Use VOID_TYPE_P rather | |
3519 | than checking against void_type_node. | |
3520 | ||
09bea584 DM |
3521 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
3522 | ||
3523 | PR analyzer/93373 | |
3524 | * region-model.cc (ASSERT_COMPAT_TYPES): Convert to... | |
3525 | (assert_compat_types): ...this, and bail when either type is NULL, | |
3526 | or when VOID_TYPE_P (dst_type). | |
3527 | (region_model::get_lvalue): Update for above conversion. | |
3528 | (region_model::get_rvalue): Likewise. | |
3529 | ||
f1c807e8 DM |
3530 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
3531 | ||
3532 | PR analyzer/93379 | |
3533 | * region-model.cc (region_model::update_for_return_superedge): | |
3534 | Move check for null result so that it also guards setting the | |
3535 | lhs. | |
3536 | ||
455f58ec DM |
3537 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
3538 | ||
3539 | PR analyzer/93438 | |
3540 | * region-model.cc (stack_region::can_merge_p): Split into a two | |
3541 | pass approach, creating all stack regions first, then populating | |
3542 | them. | |
3543 | (selftest::test_state_merging): Add test coverage for (a) the case | |
3544 | of self-merging a model in which a local in an older stack frame | |
3545 | points to a local in a more recent stack frame (which previously | |
3546 | would ICE), and (b) the case of self-merging a model in which a | |
3547 | local points to a global (which previously worked OK). | |
3548 | ||
182ce042 DM |
3549 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
3550 | ||
3551 | * analyzer.cc (is_named_call_p): Replace tests for fndecl being | |
3552 | extern at file scope and having a non-NULL DECL_NAME with a call | |
3553 | to maybe_special_function_p. | |
3554 | * function-set.cc (function_set::contains_decl_p): Add call to | |
3555 | maybe_special_function_p. | |
3556 | ||
45eb3e49 DM |
3557 | 2020-01-31 David Malcolm <dmalcolm@redhat.com> |
3558 | ||
3559 | PR analyzer/93450 | |
3560 | * constraint-manager.cc | |
3561 | (constraint_manager::get_or_add_equiv_class): Only compare constants | |
3562 | if their types are compatible. | |
3563 | * region-model.cc (constant_svalue::eval_condition): Replace check | |
3564 | for identical types with call to types_compatible_p. | |
3565 | ||
42f36563 DM |
3566 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
3567 | ||
3568 | * program-state.cc (extrinsic_state::dump_to_pp): New. | |
3569 | (extrinsic_state::dump_to_file): New. | |
3570 | (extrinsic_state::dump): New. | |
3571 | * program-state.h (extrinsic_state::dump_to_pp): New decl. | |
3572 | (extrinsic_state::dump_to_file): New decl. | |
3573 | (extrinsic_state::dump): New decl. | |
3574 | * sm.cc: Include "pretty-print.h". | |
3575 | (state_machine::dump_to_pp): New. | |
3576 | * sm.h (state_machine::dump_to_pp): New decl. | |
3577 | ||
ebe9174e DM |
3578 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
3579 | ||
3580 | * diagnostic-manager.cc (for_each_state_change): Use | |
3581 | extrinsic_state::get_num_checkers rather than accessing m_checkers | |
3582 | directly. | |
3583 | * program-state.cc (program_state::program_state): Likewise. | |
3584 | * program-state.h (extrinsic_state::m_checkers): Make private. | |
3585 | ||
e978955d DM |
3586 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
3587 | ||
3588 | PR analyzer/93356 | |
3589 | * region-model.cc (region_model::eval_condition): In both | |
3590 | overloads, bail out immediately on floating-point types. | |
3591 | (region_model::eval_condition_without_cm): Likewise. | |
3592 | (region_model::add_constraint): Likewise. | |
3593 | ||
d177c49c DM |
3594 | 2020-01-30 David Malcolm <dmalcolm@redhat.com> |
3595 | ||
3596 | PR analyzer/93450 | |
3597 | * program-state.cc (sm_state_map::set_state): For the overload | |
3598 | taking an svalue_id, bail out if the set_state on the ec does | |
3599 | nothing. Convert the latter's return type from void to bool, | |
3600 | returning true if anything changed. | |
3601 | (sm_state_map::impl_set_state): Convert the return type from void | |
3602 | to bool, returning true if the state changed. | |
3603 | * program-state.h (sm_state_map::set_state): Convert return type | |
3604 | from void to bool. | |
3605 | (sm_state_map::impl_set_state): Likewise. | |
3606 | * region-model.cc (constant_svalue::eval_condition): Only call | |
3607 | fold_build2 if the types are the same. | |
3608 | ||
7892ff37 JJ |
3609 | 2020-01-29 Jakub Jelinek <jakub@redhat.com> |
3610 | ||
3611 | * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Remove. | |
3612 | * constraint-manager.cc: Include diagnostic-core.h before graphviz.h. | |
3613 | (range::dump, equiv_class::print): Don't use PUSH_IGNORE_WFORMAT or | |
3614 | POP_IGNORE_WFORMAT. | |
3615 | * state-purge.cc: Include diagnostic-core.h before | |
3616 | gimple-pretty-print.h. | |
3617 | (state_purge_annotator::add_node_annotations, print_vec_of_names): | |
3618 | Don't use PUSH_IGNORE_WFORMAT or POP_IGNORE_WFORMAT. | |
3619 | * region-model.cc: Move diagnostic-core.h include before graphviz.h. | |
3620 | (path_var::dump, svalue::print, constant_svalue::print_details, | |
3621 | region::dump_to_pp, region::dump_child_label, region::print_fields, | |
3622 | map_region::print_fields, map_region::dump_dot_to_pp, | |
3623 | map_region::dump_child_label, array_region::print_fields, | |
3624 | array_region::dump_dot_to_pp): Don't use PUSH_IGNORE_WFORMAT or | |
3625 | POP_IGNORE_WFORMAT. | |
3626 | ||
5aebfb71 DM |
3627 | 2020-01-28 David Malcolm <dmalcolm@redhat.com> |
3628 | ||
3629 | PR analyzer/93316 | |
3630 | * engine.cc (rewind_info_t::update_model): Get the longjmp call | |
3631 | stmt via get_longjmp_call () rather than assuming it is the last | |
3632 | stmt in the longjmp's supernode. | |
3633 | (rewind_info_t::add_events_to_path): Get the location_t for the | |
3634 | rewind_from_longjmp_event via get_longjmp_call () rather than from | |
3635 | the supernode's get_end_location (). | |
3636 | ||
6c8e5844 DM |
3637 | 2020-01-28 David Malcolm <dmalcolm@redhat.com> |
3638 | ||
3639 | * region-model.cc (poisoned_value_diagnostic::emit): Update for | |
3640 | renaming of warning_at overload to warning_meta. | |
3641 | * sm-file.cc (file_leak::emit): Likewise. | |
3642 | * sm-malloc.cc (double_free::emit): Likewise. | |
3643 | (possible_null_deref::emit): Likewise. | |
3644 | (possible_null_arg::emit): Likewise. | |
3645 | (null_deref::emit): Likewise. | |
3646 | (null_arg::emit): Likewise. | |
3647 | (use_after_free::emit): Likewise. | |
3648 | (malloc_leak::emit): Likewise. | |
3649 | (free_of_non_heap::emit): Likewise. | |
3650 | * sm-sensitive.cc (exposure_through_output_file::emit): Likewise. | |
3651 | * sm-signal.cc (signal_unsafe_call::emit): Likewise. | |
3652 | * sm-taint.cc (tainted_array_index::emit): Likewise. | |
3653 | ||
8c08c983 DM |
3654 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
3655 | ||
3656 | PR analyzer/93451 | |
3657 | * region-model.cc (tree_cmp): For the REAL_CST case, impose an | |
3658 | arbitrary order on NaNs relative to other NaNs and to non-NaNs; | |
3659 | const-correctness tweak. | |
3660 | (ana::selftests::build_real_cst_from_string): New function. | |
3661 | (ana::selftests::append_interesting_constants): New function. | |
3662 | (ana::selftests::test_tree_cmp_on_constants): New test. | |
3663 | (ana::selftests::test_canonicalization_4): New test. | |
3664 | (ana::selftests::analyzer_region_model_cc_tests): Call the new | |
3665 | tests. | |
3666 | ||
2fbea419 DM |
3667 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
3668 | ||
3669 | PR analyzer/93349 | |
3670 | * engine.cc (run_checkers): Save and restore input_location. | |
3671 | ||
6a81cabc DM |
3672 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
3673 | ||
3674 | * call-string.cc (call_string::cmp_1): Delete, moving body to... | |
3675 | (call_string::cmp): ...here. | |
3676 | * call-string.h (call_string::cmp_1): Delete decl. | |
3677 | * engine.cc (worklist::key_t::cmp_1): Delete, moving body to... | |
3678 | (worklist::key_t::cmp): ...here. Implement hash comparisons | |
3679 | via comparison rather than subtraction to avoid overflow issues. | |
3680 | * exploded-graph.h (worklist::key_t::cmp_1): Delete decl. | |
3681 | * region-model.cc (tree_cmp): Eliminate buggy checking for | |
3682 | symmetry. | |
3683 | ||
342e14ff DM |
3684 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
3685 | ||
3686 | * analyzer.cc (is_named_call_p): Check that fndecl is "extern" | |
3687 | and at file scope. Potentially disregard prefix _ or __ in | |
3688 | fndecl's name. Bail if the identifier is NULL. | |
3689 | (is_setjmp_call_p): Expect a gcall rather than plain gimple. | |
3690 | Remove special-case check for leading prefix, and also check for | |
3691 | sigsetjmp. | |
3692 | (is_longjmp_call_p): Also check for siglongjmp. | |
3693 | (get_user_facing_name): New function. | |
3694 | * analyzer.h (is_setjmp_call_p): Expect a gcall rather than plain | |
3695 | gimple. | |
3696 | (get_user_facing_name): New decl. | |
3697 | * checker-path.cc (setjmp_event::get_desc): Use | |
3698 | get_user_facing_name to avoid hardcoding the function name. | |
3699 | (rewind_event::rewind_event): Add rewind_info param, using it to | |
3700 | initialize new m_rewind_info field, and strengthen the assertion. | |
3701 | (rewind_from_longjmp_event::get_desc): Use get_user_facing_name to | |
3702 | avoid hardcoding the function name. | |
3703 | (rewind_to_setjmp_event::get_desc): Likewise. | |
3704 | * checker-path.h (setjmp_event::setjmp_event): Add setjmp_call | |
3705 | param and use it to initialize... | |
3706 | (setjmp_event::m_setjmp_call): New field. | |
3707 | (rewind_event::rewind_event): Add rewind_info param. | |
3708 | (rewind_event::m_rewind_info): New protected field. | |
3709 | (rewind_from_longjmp_event::rewind_from_longjmp_event): Add | |
3710 | rewind_info param. | |
3711 | (class rewind_to_setjmp_event): Move rewind_info field to parent | |
3712 | class. | |
3713 | * diagnostic-manager.cc (diagnostic_manager::add_events_for_eedge): | |
3714 | Update setjmp-handling for is_setjmp_call_p requiring a gcall; | |
3715 | pass the call to the new setjmp_event. | |
3716 | * engine.cc (exploded_node::on_stmt): Update for is_setjmp_call_p | |
3717 | requiring a gcall. | |
3718 | (stale_jmp_buf::emit): Use get_user_facing_name to avoid | |
3719 | hardcoding the function names. | |
3720 | (exploded_node::on_longjmp): Pass the longjmp_call when | |
3721 | constructing rewind_info. | |
3722 | (rewind_info_t::add_events_to_path): Pass the rewind_info_t to the | |
3723 | rewind_from_longjmp_event's ctor. | |
3724 | * exploded-graph.h (rewind_info_t::rewind_info_t): Add | |
3725 | longjmp_call param. | |
3726 | (rewind_info_t::get_longjmp_call): New. | |
3727 | (rewind_info_t::m_longjmp_call): New. | |
3728 | * region-model.cc (region_model::on_setjmp): Update comment to | |
3729 | indicate this is also for sigsetjmp. | |
3730 | * region-model.h (struct setjmp_record): Likewise. | |
3731 | (class setjmp_svalue): Likewise. | |
3732 | ||
26d949c8 DM |
3733 | 2020-01-27 David Malcolm <dmalcolm@redhat.com> |
3734 | ||
3735 | PR analyzer/93276 | |
3736 | * analyzer.h (PUSH_IGNORE_WFORMAT, POP_IGNORE_WFORMAT): Guard these | |
3737 | macros with GCC_VERSION >= 4006, making them no-op otherwise. | |
3738 | * engine.cc (exploded_edge::exploded_edge): Specify template for | |
3739 | base class initializer. | |
3740 | (exploded_graph::add_edge): Specify template when chaining up to | |
3741 | base class add_edge implementation. | |
3742 | (viz_callgraph_node::dump_dot): Drop redundant "typename". | |
3743 | (viz_callgraph_edge::viz_callgraph_edge): Specify template for | |
3744 | base class initializer. | |
3745 | * program-state.cc (sm_state_map::clone_with_remapping): Drop | |
3746 | redundant "typename". | |
3747 | (sm_state_map::print): Likewise. | |
3748 | (sm_state_map::hash): Likewise. | |
3749 | (sm_state_map::operator==): Likewise. | |
3750 | (sm_state_map::remap_svalue_ids): Likewise. | |
3751 | (sm_state_map::on_svalue_purge): Likewise. | |
3752 | (sm_state_map::validate): Likewise. | |
3753 | * program-state.h (sm_state_map::iterator_t): Likewise. | |
3754 | * supergraph.h (superedge::superedge): Specify template for base | |
3755 | class initializer. | |
3756 | ||
648796da DM |
3757 | 2020-01-23 David Malcolm <dmalcolm@redhat.com> |
3758 | ||
3759 | PR analyzer/93375 | |
3760 | * supergraph.cc (callgraph_superedge::get_arg_for_parm): Fail | |
3761 | gracefully is the number of parameters at the callee exceeds the | |
3762 | number of arguments at the call stmt. | |
3763 | (callgraph_superedge::get_parm_for_arg): Likewise. | |
3764 | ||
591b59eb DM |
3765 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
3766 | ||
3767 | PR analyzer/93382 | |
3768 | * program-state.cc (sm_state_map::on_svalue_purge): If the | |
3769 | entry survives, but the origin is being purged, then reset the | |
3770 | origin to null. | |
3771 | ||
c9c8aef4 DM |
3772 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
3773 | ||
3774 | * sm-signal.cc: Fix nesting of CHECKING_P and namespace ana. | |
3775 | ||
fd9982bb DM |
3776 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
3777 | ||
3778 | PR analyzer/93378 | |
3779 | * engine.cc (setjmp_svalue::compare_fields): Update for | |
3780 | replacement of m_enode with m_setjmp_record. | |
3781 | (setjmp_svalue::add_to_hash): Likewise. | |
3782 | (setjmp_svalue::get_index): Rename... | |
3783 | (setjmp_svalue::get_enode_index): ...to this. | |
3784 | (setjmp_svalue::print_details): Update for replacement of m_enode | |
3785 | with m_setjmp_record. | |
3786 | (exploded_node::on_longjmp): Likewise. | |
3787 | * exploded-graph.h (rewind_info_t::m_enode_origin): Replace... | |
3788 | (rewind_info_t::m_setjmp_record): ...with this. | |
3789 | (rewind_info_t::rewind_info_t): Update for replacement of m_enode | |
3790 | with m_setjmp_record. | |
3791 | (rewind_info_t::get_setjmp_point): Likewise. | |
3792 | (rewind_info_t::get_setjmp_call): Likewise. | |
3793 | * region-model.cc (region_model::dump_summary_of_map): Likewise. | |
3794 | (region_model::on_setjmp): Likewise. | |
3795 | * region-model.h (struct setjmp_record): New struct. | |
3796 | (setjmp_svalue::m_enode): Replace... | |
3797 | (setjmp_svalue::m_setjmp_record): ...with this. | |
3798 | (setjmp_svalue::setjmp_svalue): Update for replacement of m_enode | |
3799 | with m_setjmp_record. | |
3800 | (setjmp_svalue::clone): Likewise. | |
3801 | (setjmp_svalue::get_index): Rename... | |
3802 | (setjmp_svalue::get_enode_index): ...to this. | |
3803 | (setjmp_svalue::get_exploded_node): Replace... | |
3804 | (setjmp_svalue::get_setjmp_record): ...with this. | |
3805 | ||
da7cf663 DM |
3806 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
3807 | ||
3808 | PR analyzer/93316 | |
3809 | * analyzer.cc (is_setjmp_call_p): Check for "setjmp" as well as | |
3810 | "_setjmp". | |
3811 | ||
75038aa6 DM |
3812 | 2020-01-22 David Malcolm <dmalcolm@redhat.com> |
3813 | ||
3814 | PR analyzer/93307 | |
3815 | * analysis-plan.h: Wrap everything namespace "ana". | |
3816 | * analyzer-logging.cc: Likewise. | |
3817 | * analyzer-logging.h: Likewise. | |
3818 | * analyzer-pass.cc (pass_analyzer::execute): Update for "ana" | |
3819 | namespace. | |
3820 | * analyzer-selftests.cc: Wrap everything namespace "ana". | |
3821 | * analyzer-selftests.h: Likewise. | |
3822 | * analyzer.h: Likewise for forward decls of types. | |
3823 | * call-string.h: Likewise. | |
3824 | * checker-path.cc: Likewise. | |
3825 | * checker-path.h: Likewise. | |
3826 | * constraint-manager.cc: Likewise. | |
3827 | * constraint-manager.h: Likewise. | |
3828 | * diagnostic-manager.cc: Likewise. | |
3829 | * diagnostic-manager.h: Likewise. | |
3830 | * engine.cc: Likewise. | |
3831 | * engine.h: Likewise. | |
3832 | * exploded-graph.h: Likewise. | |
3833 | * function-set.cc: Likewise. | |
3834 | * function-set.h: Likewise. | |
3835 | * pending-diagnostic.cc: Likewise. | |
3836 | * pending-diagnostic.h: Likewise. | |
3837 | * program-point.cc: Likewise. | |
3838 | * program-point.h: Likewise. | |
3839 | * program-state.cc: Likewise. | |
3840 | * program-state.h: Likewise. | |
3841 | * region-model.cc: Likewise. | |
3842 | * region-model.h: Likewise. | |
3843 | * sm-file.cc: Likewise. | |
3844 | * sm-malloc.cc: Likewise. | |
3845 | * sm-pattern-test.cc: Likewise. | |
3846 | * sm-sensitive.cc: Likewise. | |
3847 | * sm-signal.cc: Likewise. | |
3848 | * sm-taint.cc: Likewise. | |
3849 | * sm.cc: Likewise. | |
3850 | * sm.h: Likewise. | |
3851 | * state-purge.h: Likewise. | |
3852 | * supergraph.cc: Likewise. | |
3853 | * supergraph.h: Likewise. | |
3854 | ||
4f01e577 DM |
3855 | 2020-01-21 David Malcolm <dmalcolm@redhat.com> |
3856 | ||
3857 | PR analyzer/93352 | |
3858 | * region-model.cc (int_cmp): Rename to... | |
3859 | (array_region::key_cmp): ...this, using key_t rather than int. | |
3860 | Rewrite in terms of comparisons rather than subtraction to | |
3861 | ensure qsort is anti-symmetric when handling extreme values. | |
3862 | (array_region::walk_for_canonicalization): Update for above | |
3863 | renaming. | |
3864 | * region-model.h (array_region::key_cmp): New decl. | |
3865 | ||
07c86323 DM |
3866 | 2020-01-17 David Malcolm <dmalcolm@redhat.com> |
3867 | ||
3868 | PR analyzer/93290 | |
3869 | * region-model.cc (region_model::eval_condition_without_cm): Avoid | |
3870 | gcc_unreachable for unexpected operations for the case where | |
3871 | we're comparing an svalue against itself. | |
3872 | ||
5f030383 DM |
3873 | 2020-01-17 David Malcolm <dmalcolm@redhat.com> |
3874 | ||
3875 | PR analyzer/93281 | |
3876 | * region-model.cc | |
3877 | (region_model::convert_byte_offset_to_array_index): Convert to | |
3878 | ssizetype before dividing by byte_size. Use fold_binary rather | |
3879 | than fold_build2 to avoid needlessly constructing a tree for the | |
3880 | non-const case. | |
3881 | ||
49e9a999 DM |
3882 | 2020-01-15 David Malcolm <dmalcolm@redhat.com> |
3883 | ||
3884 | * engine.cc (class impl_region_model_context): Fix comment. | |
3885 | ||
32077b69 DM |
3886 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3887 | ||
3888 | PR analyzer/93212 | |
3889 | * region-model.cc (make_region_for_type): Use | |
3890 | FUNC_OR_METHOD_TYPE_P rather than comparing against FUNCTION_TYPE. | |
3891 | * region-model.h (function_region::function_region): Likewise. | |
3892 | ||
7fb3669e DM |
3893 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3894 | ||
3895 | * program-state.cc (sm_state_map::clone_with_remapping): Copy | |
3896 | m_global_state. | |
3897 | (selftest::test_program_state_merging_2): New selftest. | |
3898 | (selftest::analyzer_program_state_cc_tests): Call it. | |
3899 | ||
e2a538b1 DM |
3900 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3901 | ||
3902 | * checker-path.h (checker_path::get_checker_event): New function. | |
3903 | (checker_path): Add DISABLE_COPY_AND_ASSIGN; make fields private. | |
3904 | * diagnostic-manager.cc | |
3905 | (diagnostic_manager::prune_for_sm_diagnostic): Replace direct | |
3906 | access to checker_path::m_events with accessor functions. Fix | |
3907 | overlong line. | |
3908 | (diagnostic_manager::prune_interproc_events): Replace direct | |
3909 | access to checker_path::m_events with accessor functions. | |
3910 | (diagnostic_manager::finish_pruning): Likewise. | |
3911 | ||
94946989 DM |
3912 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3913 | ||
3914 | * checker-path.h (checker_event::clone): Delete vfunc decl. | |
3915 | (debug_event::clone): Delete vfunc impl. | |
3916 | (custom_event::clone): Delete vfunc impl. | |
3917 | (statement_event::clone): Delete vfunc impl. | |
3918 | (function_entry_event::clone): Delete vfunc impl. | |
3919 | (state_change_event::clone): Delete vfunc impl. | |
3920 | (start_cfg_edge_event::clone): Delete vfunc impl. | |
3921 | (end_cfg_edge_event::clone): Delete vfunc impl. | |
3922 | (call_event::clone): Delete vfunc impl. | |
3923 | (return_event::clone): Delete vfunc impl. | |
3924 | (setjmp_event::clone): Delete vfunc impl. | |
3925 | (rewind_from_longjmp_event::clone): Delete vfunc impl. | |
3926 | (rewind_to_setjmp_event::clone): Delete vfunc impl. | |
3927 | (warning_event::clone): Delete vfunc impl. | |
3928 | ||
718930c0 DM |
3929 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3930 | ||
3931 | * supergraph.cc (supernode::dump_dot): Ensure that the TABLE | |
3932 | element has at least one TR. | |
3933 | ||
8397af8e DM |
3934 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3935 | ||
3936 | PR analyzer/58237 | |
3937 | * engine.cc (leak_stmt_finder::find_stmt): Use get_pure_location | |
3938 | when comparing against UNKNOWN_LOCATION. | |
3939 | (stmt_requires_new_enode_p): Likewise. | |
3940 | (exploded_graph::dump_exploded_nodes): Likewise. | |
3941 | * supergraph.cc (supernode::get_start_location): Likewise. | |
3942 | (supernode::get_end_location): Likewise. | |
3943 | ||
697251b7 DM |
3944 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3945 | ||
3946 | PR analyzer/58237 | |
3947 | * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call | |
3948 | selftest::analyzer_sm_file_cc_tests. | |
3949 | * analyzer-selftests.h (selftest::analyzer_sm_file_cc_tests): New | |
3950 | decl. | |
3951 | * sm-file.cc: Include "analyzer/function-set.h" and | |
3952 | "analyzer/analyzer-selftests.h". | |
3953 | (get_file_using_fns): New function. | |
3954 | (is_file_using_fn_p): New function. | |
3955 | (fileptr_state_machine::on_stmt): Return true for known functions. | |
3956 | (selftest::analyzer_sm_file_cc_tests): New function. | |
3957 | ||
4804c5fe DM |
3958 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3959 | ||
3960 | * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call | |
3961 | selftest::analyzer_sm_signal_cc_tests. | |
3962 | * analyzer-selftests.h (selftest::analyzer_sm_signal_cc_tests): | |
3963 | New decl. | |
3964 | * sm-signal.cc: Include "analyzer/function-set.h" and | |
3965 | "analyzer/analyzer-selftests.h". | |
3966 | (get_async_signal_unsafe_fns): New function. | |
3967 | (signal_unsafe_p): Reimplement in terms of the above. | |
3968 | (selftest::analyzer_sm_signal_cc_tests): New function. | |
3969 | ||
a6b5f19c DM |
3970 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3971 | ||
3972 | * analyzer-selftests.cc (selftest::run_analyzer_selftests): Call | |
3973 | selftest::analyzer_function_set_cc_tests. | |
3974 | * analyzer-selftests.h (selftest::analyzer_function_set_cc_tests): | |
3975 | New decl. | |
3976 | * function-set.cc: New file. | |
3977 | * function-set.h: New file. | |
3978 | ||
ef7827b0 DM |
3979 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
3980 | ||
3981 | * analyzer.h (fndecl_has_gimple_body_p): New decl. | |
3982 | * engine.cc (impl_region_model_context::on_unknown_change): New | |
3983 | function. | |
3984 | (fndecl_has_gimple_body_p): Make non-static. | |
3985 | (exploded_node::on_stmt): Treat __analyzer_dump_exploded_nodes as | |
3986 | known. Track whether we have a call with unknown side-effects and | |
3987 | pass it to on_call_post. | |
3988 | * exploded-graph.h (impl_region_model_context::on_unknown_change): | |
3989 | New decl. | |
3990 | * program-state.cc (sm_state_map::on_unknown_change): New function. | |
3991 | * program-state.h (sm_state_map::on_unknown_change): New decl. | |
3992 | * region-model.cc: Include "bitmap.h". | |
3993 | (region_model::on_call_pre): Return a bool, capturing whether the | |
3994 | call has unknown side effects. | |
3995 | (region_model::on_call_post): Add arg "bool unknown_side_effects" | |
3996 | and if true, call handle_unrecognized_call. | |
3997 | (class reachable_regions): New class. | |
3998 | (region_model::handle_unrecognized_call): New function. | |
3999 | * region-model.h (region_model::on_call_pre): Return a bool. | |
4000 | (region_model::on_call_post): Add arg "bool unknown_side_effects". | |
4001 | (region_model::handle_unrecognized_call): New decl. | |
4002 | (region_model_context::on_unknown_change): New vfunc. | |
4003 | (test_region_model_context::on_unknown_change): New function. | |
4004 | ||
14f9d7b9 DM |
4005 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
4006 | ||
4007 | * diagnostic-manager.cc (saved_diagnostic::operator==): Move here | |
4008 | from header. Replace pointer equality test on m_var with call to | |
4009 | pending_diagnostic::same_tree_p. | |
4010 | * diagnostic-manager.h (saved_diagnostic::operator==): Move to | |
4011 | diagnostic-manager.cc. | |
4012 | * pending-diagnostic.cc (pending_diagnostic::same_tree_p): New. | |
4013 | * pending-diagnostic.h (pending_diagnostic::same_tree_p): New. | |
4014 | * sm-file.cc (file_diagnostic::subclass_equal_p): Replace pointer | |
4015 | equality on m_arg with call to pending_diagnostic::same_tree_p. | |
4016 | * sm-malloc.cc (malloc_diagnostic::subclass_equal_p): Likewise. | |
4017 | (possible_null_arg::subclass_equal_p): Likewise. | |
4018 | (null_arg::subclass_equal_p): Likewise. | |
4019 | (free_of_non_heap::subclass_equal_p): Likewise. | |
4020 | * sm-pattern-test.cc (pattern_match::operator==): Likewise. | |
4021 | * sm-sensitive.cc (exposure_through_output_file::operator==): | |
4022 | Likewise. | |
4023 | * sm-taint.cc (tainted_array_index::operator==): Likewise. | |
4024 | ||
f474fbd5 DM |
4025 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
4026 | ||
4027 | * diagnostic-manager.cc (dedupe_winners::add): Add logging | |
4028 | of deduplication decisions made. | |
4029 | ||
757bf1df DM |
4030 | 2020-01-14 David Malcolm <dmalcolm@redhat.com> |
4031 | ||
4032 | * ChangeLog: New file. | |
4033 | * analyzer-selftests.cc: New file. | |
4034 | * analyzer-selftests.h: New file. | |
4035 | * analyzer.opt: New file. | |
4036 | * analysis-plan.cc: New file. | |
4037 | * analysis-plan.h: New file. | |
4038 | * analyzer-logging.cc: New file. | |
4039 | * analyzer-logging.h: New file. | |
4040 | * analyzer-pass.cc: New file. | |
4041 | * analyzer.cc: New file. | |
4042 | * analyzer.h: New file. | |
4043 | * call-string.cc: New file. | |
4044 | * call-string.h: New file. | |
4045 | * checker-path.cc: New file. | |
4046 | * checker-path.h: New file. | |
4047 | * constraint-manager.cc: New file. | |
4048 | * constraint-manager.h: New file. | |
4049 | * diagnostic-manager.cc: New file. | |
4050 | * diagnostic-manager.h: New file. | |
4051 | * engine.cc: New file. | |
4052 | * engine.h: New file. | |
4053 | * exploded-graph.h: New file. | |
4054 | * pending-diagnostic.cc: New file. | |
4055 | * pending-diagnostic.h: New file. | |
4056 | * program-point.cc: New file. | |
4057 | * program-point.h: New file. | |
4058 | * program-state.cc: New file. | |
4059 | * program-state.h: New file. | |
4060 | * region-model.cc: New file. | |
4061 | * region-model.h: New file. | |
4062 | * sm-file.cc: New file. | |
4063 | * sm-malloc.cc: New file. | |
4064 | * sm-malloc.dot: New file. | |
4065 | * sm-pattern-test.cc: New file. | |
4066 | * sm-sensitive.cc: New file. | |
4067 | * sm-signal.cc: New file. | |
4068 | * sm-taint.cc: New file. | |
4069 | * sm.cc: New file. | |
4070 | * sm.h: New file. | |
4071 | * state-purge.cc: New file. | |
4072 | * state-purge.h: New file. | |
4073 | * supergraph.cc: New file. | |
4074 | * supergraph.h: New file. | |
4075 | ||
4076 | 2019-12-13 David Malcolm <dmalcolm@redhat.com> | |
4077 | ||
4078 | * Initial creation | |
4079 | ||
4080 | \f | |
c48514be | 4081 | Copyright (C) 2019-2021 Free Software Foundation, Inc. |
757bf1df DM |
4082 | |
4083 | Copying and distribution of this file, with or without modification, | |
4084 | are permitted in any medium without royalty provided the copyright | |
4085 | notice and this notice are preserved. |