aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-array-bounds.h
AgeCommit message (Collapse)AuthorFilesLines
2023-04-26Remove range_query::get_value_range.Aldy Hernandez1-1/+1
gcc/ChangeLog: * gimple-array-bounds.cc (array_bounds_checker::get_value_range): Add irange argument. (check_out_of_bounds_and_warn): Remove check for vr. (array_bounds_checker::check_array_ref): Remove pointer qualifier for vr and adjust accordingly. * gimple-array-bounds.h (get_value_range): Add irange argument. * value-query.cc (class equiv_allocator): Delete. (range_query::get_value_range): Delete. (range_query::range_query): Remove allocator access. (range_query::~range_query): Same. * value-query.h (get_value_range): Delete. * vr-values.cc (simplify_using_ranges::op_with_boolean_value_range_p): Remove call to get_value_range. (check_for_binary_op_overflow): Same. (simplify_using_ranges::legacy_fold_cond_overflow): Same. (simplify_using_ranges::simplify_abs_using_ranges): Same. (simplify_using_ranges::simplify_cond_using_ranges_1): Same. (simplify_using_ranges::simplify_casted_cond): Same. (simplify_using_ranges::simplify_switch_using_ranges): Same. (simplify_using_ranges::two_valued_val_range_p): Same.
2023-01-02Update copyright years.Jakub Jelinek1-1/+1
2022-02-03Enable pointer_query caching in -Warray-bounds.Martin Sebor1-4/+6
gcc/ChangeLog: * gimple-array-bounds.cc (array_bounds_checker::array_bounds_checker): Define ctor. (array_bounds_checker::get_value_range): Use new member. (array_bounds_checker::check_mem_ref): Same. * gimple-array-bounds.h (array_bounds_checker::array_bounds_checker): Outline ctor. (array_bounds_checker::m_ptr_query): New member.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-10-26Make full use of context-sensitive ranges in access warnings.Martin Sebor1-0/+4
gcc/ChangeLog: * builtins.c (check_strncat_sizes): Pass access_data ctor additional arguments. (expand_builtin_memcmp): Move code to gimple-ssa-warn-access.cc. (expand_builtin_fork_or_exec): Same. * gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Pass compute_objsize additional arguments. (inbounds_memaccess_p): Same. (array_bounds_checker::check_array_bounds): Add an assert. Stash statement in a member. (check_array_bounds_dom_walker::before_dom_children): Same. * gimple-array-bounds.h (array_bounds_checker::m_stmt): New member. * gimple-ssa-sprintf.c (get_destination_size): Add an argument. (handle_printf_call): Pass a new argument. * gimple-ssa-warn-access.cc (get_size_range): Add an argument. (check_access): Add an argument and pass it along to callees. (check_read_access): Make a member function. (pass_waccess::check_strcat): Pass access_data ctor additional arguments. (pass_waccess::check_strncat): Same. (pass_waccess::check_stxcpy): Same. (pass_waccess::check_stxncpy): Same. (pass_waccess::check_strncmp): Same. (pass_waccess::check_read_access): Same. (pass_waccess::check_builtin): Same. (pass_waccess::maybe_check_access_sizes): Same. (pass_waccess::maybe_check_dealloc_call): Same. * gimple-ssa-warn-access.h (check_read_access): Declare a new member function. * pointer-query.cc (compute_objsize_r): Add an argument. (gimple_call_return_array): Same. (gimple_call_alloc_size): Same. (access_ref::access_ref): Same. (access_ref::get_ref): Same. (pointer_query::get_ref): Same. (handle_min_max_size): Pass an arguments to callees. (handle_array_ref): Add an argument. (handle_mem_ref): Same. (compute_objsize): Same. * pointer-query.h (struct access_ref): Adjust signatures. (struct access_data): Same. (gimple_call_alloc_size): Add an argument. (gimple_parm_array_size): Same. (compute_objsize): Same. * tree-ssa-strlen.c (strlen_pass::adjust_last_stmt): Pass an additional argument to compute_objsize. (strlen_pass::maybe_warn_overflow): Same. (maybe_diag_stxncpy_trunc): Same. gcc/testsuite/ChangeLog: * gcc.dg/Wstringop-overflow-22.c: Correct typos. * gcc.dg/Wstringop-overflow-81.c: New test. libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/capacity/1.cc: Also suppress -Wstringop-overread. * testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc: Same.
2021-07-26Pass gimple context to array_bounds_checker.Aldy Hernandez1-3/+3
I have changed the use of the array_bounds_checker in VRP to use a ranger in my local tree to make sure there are no regressions when using either VRP or the ranger. In doing so I noticed that the checker does not pass context to get_value_range, which causes the ranger to miss a few cases. This patch fixes the oversight. Tested on x86-64 Linux using the array bounds checker both with VRP and the ranger. gcc/ChangeLog: * gimple-array-bounds.cc (array_bounds_checker::get_value_range): Add gimple argument. (array_bounds_checker::check_array_ref): Same. (array_bounds_checker::check_addr_expr): Same. (array_bounds_checker::check_array_bounds): Pass statement to check_array_bounds and check_addr_expr. * gimple-array-bounds.h (check_array_bounds): Add gimple argument. (check_addr_expr): Same. (get_value_range): Same.
2021-07-23Use range_query object in array bounds class.Aldy Hernandez1-2/+2
Now that all dependencies of array_bounds_checker take a range_query, we can sever the relationship with vr_values. Changing this will allow us to use the array_bounds_checker with VRP, evrp, or the ranger. Tested on x86-64 Linux. gcc/ChangeLog: * gimple-array-bounds.h (class array_bounds_checker): Change ranges type to range_query.
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-06-01Move array bounds checking into its own file.Aldy Hernandez1-0/+43
gcc/ * Makefile.in (gimple-array-bounds.o): New. * tree-vrp.c: Move array bounds code... * gimple-array-bounds.cc: ...here... * gimple-array-bounds.h: ...and here.