comparison gcc/analyzer/ChangeLog @ 145:1830386684a0

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