GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "ssa.h"
#include "pointer-query.h"
#include "gimple-array-bounds.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "tree-dfa.h"
#include "fold-const.h"
#include "diagnostic-core.h"
#include "intl.h"
#include "tree-vrp.h"
#include "alloc-pool.h"
#include "vr-values.h"
#include "domwalk.h"
#include "tree-cfg.h"
#include "attribs.h"
#include "tree-pass.h"
#include "gimple-range.h"
Data Structures | |
class | check_array_bounds_dom_walker |
class | pass_array_bounds |
Functions | |
static tree | get_base_decl (tree ref) |
static tree | get_ref_size (tree arg, tree *pref) |
static bool | trailing_array (tree arg, tree *pref) |
static void | get_up_bounds_for_array_ref (tree ref, tree *decl, tree *up_bound, tree *up_bound_p1) |
static bool | check_out_of_bounds_and_warn (location_t location, tree ref, tree low_sub_org, tree low_sub, tree up_sub, tree up_bound, tree up_bound_p1, const irange *vr, bool ignore_off_by_one, bool for_array_bound, bool *out_of_bound) |
static bool | inbounds_memaccess_p (tree t, gimple *stmt) |
gimple_opt_pass * | make_pass_array_bounds (gcc::context *ctxt) |
Variables | |
const pass_data | pass_data_array_bounds |
|
static |
Given the LOW_SUB_ORG, LOW_SUB and UP_SUB, and the computed UP_BOUND and UP_BOUND_P1, check whether the array reference REF is out of bound. When out of bounds, set OUT_OF_BOUND to true. Issue warnings if FOR_ARRAY_BOUND is true. return TRUE if warnings are issued.
References array_ref_low_bound(), get_legacy_range(), TREE_CODE, tree_int_cst_equal(), tree_int_cst_le(), tree_int_cst_lt(), TREE_OPERAND, TREE_TYPE, VR_ANTI_RANGE, and warning_at().
Referenced by array_bounds_checker::check_array_ref().
Try to determine the DECL that REF refers to. Return the DECL or the expression closest to it. Used in informational notes pointing to referenced objects or function parameters.
References DECL_P, get_base_address(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_nop_p(), SSA_NAME_DEF_STMT, SSA_NAME_VAR, TREE_CODE, and TREE_OPERAND.
Referenced by get_ref_size(), and trailing_array().
Return the constant byte size of the object or type referenced by the MEM_REF ARG. On success, set *PREF to the DECL or expression ARG refers to. Otherwise return null.
References get_base_decl(), NULL_TREE, POINTER_TYPE_P, pref, TREE_CODE, TREE_OPERAND, TREE_TYPE, and TYPE_SIZE_UNIT.
Referenced by get_up_bounds_for_array_ref().
|
static |
Acquire the upper bound and upper bound plus one for the array reference REF and record them into UP_BOUND and UP_BOUND_P1. Set *DECL to the decl or expresssion REF refers to.
References array_ref_element_size(), build_int_cst(), component_ref_size(), DECL_P, DECL_SIZE_UNIT, fold_convert, get_addr_base_and_unit_offset(), get_ref_size(), int_const_binop(), integer_zerop(), known_gt, NULL_TREE, ptrdiff_type_node, sizetype, wi::sub(), wi::to_wide(), trailing_array(), TREE_CODE, TREE_OPERAND, TREE_TYPE, TYPE_MAX_VALUE, and wide_int_to_tree().
Referenced by array_bounds_checker::check_array_ref().
Return true if T is a reference to a member of a base class that's within the bounds of the enclosing complete object. The function "hacks" around problems discussed in pr98266 and pr97595.
References byte_position(), compute_objsize(), DECL_SIZE_UNIT, int_const_binop(), RECORD_OR_UNION_TYPE_P, TREE_CODE, tree_int_cst_le(), tree_int_cst_lt(), TREE_OPERAND, TREE_TYPE, and TYPE_BINFO.
Referenced by array_bounds_checker::check_array_bounds().
gimple_opt_pass * make_pass_array_bounds | ( | gcc::context * | ctxt | ) |
References pass_data_array_bounds.
Return true if REF is (likely) an ARRAY_REF to a trailing array member of a struct. It refines array_ref_flexible_size_p by detecting a pointer to an array and an array parameter declared using the [N] syntax (as opposed to a pointer) and returning false. Set *PREF to the decl or expression REF refers to.
References array_ref_flexible_size_p(), get_base_decl(), POINTER_TYPE_P, pref, TREE_CODE, TREE_OPERAND, and TREE_TYPE.
Referenced by get_up_bounds_for_array_ref().
const pass_data pass_data_array_bounds |
Referenced by make_pass_array_bounds().