bool c_omp_check_loop_iv_exprs (location_t stmt_loc, tree declv, tree decl, tree init, tree cond, walk_tree_lh lh) { hash_set<tree> pset; struct c_omp_check_loop_iv_data data; data.declv = declv; data.fail = false; data.stmt_loc = stmt_loc; data.lh = lh; data.ppset = &pset; if (init) { data.expr_loc = EXPR_LOCATION (init); data.kind = 0; walk_tree_1 (&init, c_omp_check_loop_iv_r, &data, &pset, lh); } if (cond) { gcc_assert (COMPARISON_CLASS_P (cond)); data.expr_loc = EXPR_LOCATION (init); data.kind = 1; if (TREE_OPERAND (cond, 0) == decl) walk_tree_1 (&TREE_OPERAND (cond, 1), c_omp_check_loop_iv_r, &data, &pset, lh); else walk_tree_1 (&TREE_OPERAND (cond, 0), c_omp_check_loop_iv_r, &data, &pset, lh); } return !data.fail; }
bool cilk_recognize_spawn (tree exp, tree *exp0) { bool spawn_found = false; if (TREE_CODE (exp) == CILK_SPAWN_STMT) { /* Remove the CALL_EXPR from CILK_SPAWN_STMT wrapper. */ exp = CILK_SPAWN_FN (exp); walk_tree (exp0, unwrap_cilk_spawn_stmt, NULL, NULL); spawn_found = true; } /* _Cilk_spawn can't be wrapped in expression such as PLUS_EXPR. */ else if (contains_cilk_spawn_stmt (exp)) { location_t loc = EXPR_LOCATION (exp); if (loc == UNKNOWN_LOCATION) { tree stmt = walk_tree (&exp, contains_cilk_spawn_stmt_walker, NULL, NULL); gcc_assert (stmt != NULL_TREE); loc = EXPR_LOCATION (stmt); } error_at (loc, "invalid use of %<_Cilk_spawn%>"); } return spawn_found; }
bool c_omp_check_loop_iv (tree stmt, tree declv, walk_tree_lh lh) { hash_set<tree> pset; struct c_omp_check_loop_iv_data data; int i; data.declv = declv; data.fail = false; data.stmt_loc = EXPR_LOCATION (stmt); data.lh = lh; data.ppset = &pset; for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (stmt)); i++) { tree init = TREE_VEC_ELT (OMP_FOR_INIT (stmt), i); gcc_assert (TREE_CODE (init) == MODIFY_EXPR); tree decl = TREE_OPERAND (init, 0); tree cond = TREE_VEC_ELT (OMP_FOR_COND (stmt), i); gcc_assert (COMPARISON_CLASS_P (cond)); gcc_assert (TREE_OPERAND (cond, 0) == decl); tree incr = TREE_VEC_ELT (OMP_FOR_INCR (stmt), i); data.expr_loc = EXPR_LOCATION (TREE_OPERAND (init, 1)); data.kind = 0; walk_tree_1 (&TREE_OPERAND (init, 1), c_omp_check_loop_iv_r, &data, &pset, lh); /* Don't warn for C++ random access iterators here, the expression then involves the subtraction and always refers to the original value. The C++ FE needs to warn on those earlier. */ if (decl == TREE_VEC_ELT (declv, i)) { data.expr_loc = EXPR_LOCATION (cond); data.kind = 1; walk_tree_1 (&TREE_OPERAND (cond, 1), c_omp_check_loop_iv_r, &data, &pset, lh); } if (TREE_CODE (incr) == MODIFY_EXPR) { gcc_assert (TREE_OPERAND (incr, 0) == decl); incr = TREE_OPERAND (incr, 1); data.kind = 2; if (TREE_CODE (incr) == PLUS_EXPR && TREE_OPERAND (incr, 1) == decl) { data.expr_loc = EXPR_LOCATION (TREE_OPERAND (incr, 0)); walk_tree_1 (&TREE_OPERAND (incr, 0), c_omp_check_loop_iv_r, &data, &pset, lh); } else { data.expr_loc = EXPR_LOCATION (TREE_OPERAND (incr, 1)); walk_tree_1 (&TREE_OPERAND (incr, 1), c_omp_check_loop_iv_r, &data, &pset, lh); } } } return !data.fail; }
static void genericize_do_stmt (tree *stmt_p, int *walk_subtrees, void *data) { tree stmt = *stmt_p; genericize_cp_loop (stmt_p, EXPR_LOCATION (stmt), DO_COND (stmt), DO_BODY (stmt), NULL_TREE, 0, walk_subtrees, data); }
static void genericize_while_stmt (tree *stmt_p, int *walk_subtrees, void *data) { tree stmt = *stmt_p; genericize_cp_loop (stmt_p, EXPR_LOCATION (stmt), WHILE_COND (stmt), WHILE_BODY (stmt), NULL_TREE, 1, walk_subtrees, data); }
static void genericize_break_stmt (tree *stmt_p) { tree label = get_bc_label (bc_break); location_t location = EXPR_LOCATION (*stmt_p); *stmt_p = build1_loc (location, GOTO_EXPR, void_type_node, label); }
void streamer_pack_tree_bitfields (struct output_block *ob, struct bitpack_d *bp, tree expr) { enum tree_code code; code = TREE_CODE (expr); /* Note that all these functions are highly sensitive to changes in the types and sizes of each of the fields being packed. */ pack_ts_base_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_INT_CST)) pack_ts_int_cst_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST)) pack_ts_real_cst_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST)) pack_ts_fixed_cst_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL)) stream_output_location (ob, bp, DECL_SOURCE_LOCATION (expr)); if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) pack_ts_decl_common_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) pack_ts_decl_wrtl_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) pack_ts_decl_with_vis_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) pack_ts_function_decl_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON)) pack_ts_type_common_value_fields (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_EXP)) stream_output_location (ob, bp, EXPR_LOCATION (expr)); if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) pack_ts_block_value_fields (ob, bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL)) pack_ts_translation_unit_decl_value_fields (ob, bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) pack_ts_target_option (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION)) pack_ts_optimization (bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) bp_pack_var_len_unsigned (bp, vec_safe_length (BINFO_BASE_ACCESSES (expr))); if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) bp_pack_var_len_unsigned (bp, CONSTRUCTOR_NELTS (expr)); }
void check_handlers (tree handlers) { tree_stmt_iterator i; /* If we don't have a STATEMENT_LIST, then we've just got one handler, and thus nothing to warn about. */ if (TREE_CODE (handlers) != STATEMENT_LIST) return; i = tsi_start (handlers); if (!tsi_end_p (i)) while (1) { tree handler = tsi_stmt (i); tsi_next (&i); /* No more handlers; nothing to shadow. */ if (tsi_end_p (i)) break; if (TREE_TYPE (handler) == NULL_TREE) permerror (EXPR_LOCATION (handler), "%<...%>" " handler must be the last handler for its try block"); else check_handlers_1 (handler, i); } }
static tree expand_return_expr (tree expr) { tree new_mod_list, new_var, new_mod, retval_expr; size_t rank = 0; location_t loc = EXPR_LOCATION (expr); if (TREE_CODE (expr) != RETURN_EXPR) return expr; if (!find_rank (loc, expr, expr, false, &rank)) return error_mark_node; /* If the return expression contains array notations, then flag it as error. */ if (rank >= 1) { error_at (loc, "array notation expression cannot be used as a return " "value"); return error_mark_node; } new_mod_list = push_stmt_list (); retval_expr = TREE_OPERAND (expr, 0); new_var = create_temporary_var (TREE_TYPE (retval_expr)); add_decl_expr (new_var); new_mod = expand_an_in_modify_expr (loc, new_var, NOP_EXPR, TREE_OPERAND (retval_expr, 1), tf_warning_or_error); TREE_OPERAND (retval_expr, 1) = new_var; TREE_OPERAND (expr, 0) = retval_expr; add_stmt (new_mod); add_stmt (expr); new_mod_list = pop_stmt_list (new_mod_list); return new_mod_list; }
void cilk_install_body_with_frame_cleanup (tree fndecl, tree orig_body, void *wd) { tree frame = make_cilk_frame (fndecl); tree dtor = create_cilk_function_exit (frame, false, false); add_local_decl (cfun, frame); cfun->language = ggc_cleared_alloc<language_function> (); location_t loc = EXPR_LOCATION (orig_body); tree list = alloc_stmt_list (); DECL_SAVED_TREE (fndecl) = list; tree fptr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (frame)), frame); tree body = cilk_install_body_pedigree_operations (fptr); gcc_assert (TREE_CODE (body) == STATEMENT_LIST); tree detach_expr = build_call_expr (cilk_detach_fndecl, 1, fptr); append_to_statement_list (detach_expr, &body); cilk_outline (fndecl, &orig_body, (struct wrapper_data *) wd); append_to_statement_list (orig_body, &body); if (flag_exceptions) { tree except_flag = set_cilk_except_flag (frame); tree except_data = set_cilk_except_data (frame); tree catch_list = alloc_stmt_list (); append_to_statement_list (except_flag, &catch_list); append_to_statement_list (except_data, &catch_list); body = create_try_catch_expr (body, catch_list); } append_to_statement_list (build_stmt (loc, TRY_FINALLY_EXPR, body, dtor), &list); }
HOST_WIDE_INT extract_sec_implicit_index_arg (location_t location, tree fn) { tree fn_arg; HOST_WIDE_INT return_int = 0; if (TREE_CODE (fn) == CALL_EXPR) { fn_arg = CALL_EXPR_ARG (fn, 0); if (TREE_CODE (fn_arg) == INTEGER_CST) return_int = int_cst_value (fn_arg); else { /* If the location is unknown, and if fn has a location, then use that information so that the user has a better idea where the error could be. */ if (location == UNKNOWN_LOCATION && EXPR_HAS_LOCATION (fn)) location = EXPR_LOCATION (fn); error_at (location, "__sec_implicit_index parameter must be an " "integer constant expression"); return -1; } } return return_int; }
tree create_cilk_function_exit (tree frame, bool detaches, bool needs_sync) { tree epi = alloc_stmt_list (); if (needs_sync) append_to_statement_list (build_cilk_sync (), &epi); tree func_ptr = build1 (ADDR_EXPR, cilk_frame_ptr_type_decl, frame); tree pop_frame = build_call_expr (cilk_pop_fndecl, 1, func_ptr); tree worker = cilk_dot (frame, CILK_TI_FRAME_WORKER, 0); tree current = cilk_arrow (worker, CILK_TI_WORKER_CUR, 0); tree parent = cilk_dot (frame, CILK_TI_FRAME_PARENT, 0); tree set_current = build2 (MODIFY_EXPR, void_type_node, current, parent); append_to_statement_list (set_current, &epi); append_to_statement_list (pop_frame, &epi); tree call = build_call_expr (cilk_leave_fndecl, 1, func_ptr); if (!detaches) { tree flags = cilk_dot (frame, CILK_TI_FRAME_FLAGS, false); tree flags_cmp_expr = fold_build2 (NE_EXPR, TREE_TYPE (flags), flags, build_int_cst (TREE_TYPE (flags), CILK_FRAME_VERSION)); call = fold_build3 (COND_EXPR, void_type_node, flags_cmp_expr, call, build_empty_stmt (EXPR_LOCATION (flags))); } append_to_statement_list (call, &epi); return epi; }
static tree cpp_validate_cilk_plus_loop_aux (tree *tp, int *walk_subtrees, void *data) { bool *valid = (bool *) data; location_t loc = EXPR_HAS_LOCATION (*tp) ? EXPR_LOCATION (*tp) : UNKNOWN_LOCATION; if (!tp || !*tp) return NULL_TREE; if (TREE_CODE (*tp) == THROW_EXPR) { error_at (loc, "throw expressions are not allowed inside loops " "marked with pragma simd"); *walk_subtrees = 0; *valid = false; } else if (TREE_CODE (*tp) == TRY_BLOCK) { error_at (loc, "try statements are not allowed inside loops marked " "with #pragma simd"); *valid = false; *walk_subtrees = 0; } return NULL_TREE; }
tree replace_invariant_exprs (tree *node) { size_t ix = 0; tree node_list = NULL_TREE; tree t = NULL_TREE, new_var = NULL_TREE, new_node; struct inv_list data; data.list_values = NULL; data.replacement = NULL; data.additional_tcodes = NULL; walk_tree (node, find_inv_trees, (void *)&data, NULL); if (vec_safe_length (data.list_values)) { node_list = push_stmt_list (); for (ix = 0; vec_safe_iterate (data.list_values, ix, &t); ix++) { new_var = build_decl (EXPR_LOCATION (t), VAR_DECL, NULL_TREE, TREE_TYPE (t)); gcc_assert (new_var != NULL_TREE && new_var != error_mark_node); new_node = build2 (MODIFY_EXPR, TREE_TYPE (t), new_var, t); add_stmt (new_node); vec_safe_push (data.replacement, new_var); } walk_tree (node, replace_inv_trees, (void *)&data, NULL); node_list = pop_stmt_list (node_list); } return node_list; }
static void genericize_if_stmt (tree *stmt_p) { tree stmt, cond, then_, else_; location_t locus = EXPR_LOCATION (*stmt_p); stmt = *stmt_p; cond = IF_COND (stmt); then_ = THEN_CLAUSE (stmt); else_ = ELSE_CLAUSE (stmt); if (!then_) then_ = build_empty_stmt (); if (!else_) else_ = build_empty_stmt (); if (integer_nonzerop (cond) && !TREE_SIDE_EFFECTS (else_)) stmt = then_; else if (integer_zerop (cond) && !TREE_SIDE_EFFECTS (then_)) stmt = else_; else stmt = build3 (COND_EXPR, void_type_node, cond, then_, else_); if (CAN_HAVE_LOCATION_P (stmt) && !EXPR_HAS_LOCATION (stmt)) SET_EXPR_LOCATION (stmt, locus); *stmt_p = stmt; }
tree maybe_resolve_dummy (tree object, bool add_capture_p) { if (!is_dummy_object (object)) return object; tree type = TYPE_MAIN_VARIANT (TREE_TYPE (object)); gcc_assert (!TYPE_PTR_P (type)); if (type != current_class_type && current_class_type && LAMBDA_TYPE_P (current_class_type) && lambda_function (current_class_type) && DERIVED_FROM_P (type, current_nonlambda_class_type ())) { /* In a lambda, need to go through 'this' capture. */ tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type); tree cap = lambda_expr_this_capture (lam, add_capture_p); if (cap && cap != error_mark_node) object = build_x_indirect_ref (EXPR_LOCATION (object), cap, RO_NULL, tf_warning_or_error); } return object; }
/* Given the jump function JFUNC, compute the lattice LAT that describes the value coming down the callsite. INFO describes the caller node so that pass-through jump functions can be evaluated. */ static void ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat, struct ipa_jump_func *jfunc) { if (jfunc->type == IPA_JF_CONST) { lat->type = IPA_CONST_VALUE; lat->constant = jfunc->value.constant; } else if (jfunc->type == IPA_JF_PASS_THROUGH) { struct ipcp_lattice *caller_lat; tree cst; caller_lat = ipcp_get_lattice (info, jfunc->value.pass_through.formal_id); lat->type = caller_lat->type; if (caller_lat->type != IPA_CONST_VALUE) return; cst = caller_lat->constant; if (jfunc->value.pass_through.operation != NOP_EXPR) { tree restype; if (TREE_CODE_CLASS (jfunc->value.pass_through.operation) == tcc_comparison) restype = boolean_type_node; else restype = TREE_TYPE (cst); cst = fold_binary (jfunc->value.pass_through.operation, restype, cst, jfunc->value.pass_through.operand); } if (!cst || !is_gimple_ip_invariant (cst)) lat->type = IPA_BOTTOM; lat->constant = cst; } else if (jfunc->type == IPA_JF_ANCESTOR) { struct ipcp_lattice *caller_lat; tree t; caller_lat = ipcp_get_lattice (info, jfunc->value.ancestor.formal_id); lat->type = caller_lat->type; if (caller_lat->type != IPA_CONST_VALUE) return; if (TREE_CODE (caller_lat->constant) != ADDR_EXPR) { /* This can happen when the constant is a NULL pointer. */ lat->type = IPA_BOTTOM; return; } t = TREE_OPERAND (caller_lat->constant, 0); t = build_ref_for_offset (EXPR_LOCATION (t), t, jfunc->value.ancestor.offset, jfunc->value.ancestor.type, NULL, false); lat->constant = build_fold_addr_expr (t); } else lat->type = IPA_BOTTOM; }
void gcc_rich_location::add_expr (tree expr) { gcc_assert (expr); if (CAN_HAVE_RANGE_P (expr)) add_range (EXPR_LOCATION (expr), false); }
static void test_string_literals (gimple *stmt) { gcall *call = check_for_named_call (stmt, "__emit_string_literal_range", 4); if (!call) return; /* We expect an ADDR_EXPR with a STRING_CST inside it for the initial arg. */ tree t_addr_string = gimple_call_arg (call, 0); if (TREE_CODE (t_addr_string) != ADDR_EXPR) { error_at (call->location, "string literal required for arg 1"); return; } tree t_string = TREE_OPERAND (t_addr_string, 0); if (TREE_CODE (t_string) != STRING_CST) { error_at (call->location, "string literal required for arg 1"); return; } tree t_caret_idx = gimple_call_arg (call, 1); if (TREE_CODE (t_caret_idx) != INTEGER_CST) { error_at (call->location, "integer constant required for arg 2"); return; } int caret_idx = TREE_INT_CST_LOW (t_caret_idx); tree t_start_idx = gimple_call_arg (call, 2); if (TREE_CODE (t_start_idx) != INTEGER_CST) { error_at (call->location, "integer constant required for arg 3"); return; } int start_idx = TREE_INT_CST_LOW (t_start_idx); tree t_end_idx = gimple_call_arg (call, 3); if (TREE_CODE (t_end_idx) != INTEGER_CST) { error_at (call->location, "integer constant required for arg 4"); return; } int end_idx = TREE_INT_CST_LOW (t_end_idx); /* A STRING_CST doesn't have a location, but the ADDR_EXPR does. */ location_t strloc = EXPR_LOCATION (t_addr_string); location_t loc; substring_loc substr_loc (strloc, TREE_TYPE (t_string), caret_idx, start_idx, end_idx); const char *err = substr_loc.get_location (&loc); if (err) error_at (strloc, "unable to read substring location: %s", err); else emit_warning (loc); }
void ubsan_maybe_instrument_reference (tree stmt) { tree op = TREE_OPERAND (stmt, 0); op = ubsan_maybe_instrument_reference_or_call (EXPR_LOCATION (stmt), op, TREE_TYPE (stmt), UBSAN_REF_BINDING); if (op) TREE_OPERAND (stmt, 0) = op; }
static void check_handlers_1 (tree master, tree_stmt_iterator i) { tree type = TREE_TYPE (master); for (; !tsi_end_p (i); tsi_next (&i)) { tree handler = tsi_stmt (i); if (TREE_TYPE (handler) && can_convert_eh (type, TREE_TYPE (handler))) { warning_at (EXPR_LOCATION (handler), 0, "exception of type %qT will be caught", TREE_TYPE (handler)); warning_at (EXPR_LOCATION (master), 0, " by earlier handler for %qT", type); break; } } }
static void write_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p) { int i; streamer_write_hwi (ob, TREE_OPERAND_LENGTH (expr)); for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++) stream_write_tree (ob, TREE_OPERAND (expr, i), ref_p); lto_output_location (ob, EXPR_LOCATION (expr)); stream_write_tree (ob, TREE_BLOCK (expr), ref_p); }
static bool cp_ubsan_maybe_instrument_member_access (tree stmt, cp_ubsan_check_member_access_data *ucmd) { if (DECL_ARTIFICIAL (TREE_OPERAND (stmt, 1))) return false; tree base = TREE_OPERAND (stmt, 0); if (!cp_ubsan_instrument_vptr_p (TREE_TYPE (base))) return false; cp_walk_tree (&base, cp_ubsan_check_member_access_r, ucmd, ucmd->pset); base = cp_ubsan_instrument_vptr (EXPR_LOCATION (stmt), base, TREE_TYPE (base), false, UBSAN_MEMBER_ACCESS); TREE_OPERAND (stmt, 0) = build_fold_indirect_ref_loc (EXPR_LOCATION (stmt), base); return true; }
static void genericize_continue_stmt (tree *stmt_p) { tree stmt_list = NULL; tree pred = build_predict_expr (PRED_CONTINUE, NOT_TAKEN); tree label = get_bc_label (bc_continue); location_t location = EXPR_LOCATION (*stmt_p); tree jump = build1_loc (location, GOTO_EXPR, void_type_node, label); append_to_statement_list (pred, &stmt_list); append_to_statement_list (jump, &stmt_list); *stmt_p = stmt_list; }
static bool recognize_spawn (tree exp, tree *exp0) { bool spawn_found = false; if (TREE_CODE (exp) == CILK_SPAWN_STMT) { /* Remove the CALL_EXPR from CILK_SPAWN_STMT wrapper. */ exp = CILK_SPAWN_FN (exp); walk_tree (exp0, unwrap_cilk_spawn_stmt, NULL, NULL); spawn_found = true; } /* _Cilk_spawn can't be wrapped in expression such as PLUS_EXPR. */ else if (contains_cilk_spawn_stmt (exp)) error_at (EXPR_LOCATION (exp), "invalid use of %<_Cilk_spawn%>"); return spawn_found; }
void ubsan_maybe_instrument_member_call (tree stmt, bool is_ctor) { if (call_expr_nargs (stmt) == 0) return; tree op = CALL_EXPR_ARG (stmt, 0); if (op == error_mark_node || !POINTER_TYPE_P (TREE_TYPE (op))) return; op = ubsan_maybe_instrument_reference_or_call (EXPR_LOCATION (stmt), op, TREE_TYPE (op), is_ctor ? UBSAN_CTOR_CALL : UBSAN_MEMBER_CALL); if (op) CALL_EXPR_ARG (stmt, 0) = op; }
static void genericize_omp_for_stmt (tree *stmt_p, int *walk_subtrees, void *data) { tree stmt = *stmt_p; location_t locus = EXPR_LOCATION (stmt); tree clab = begin_bc_block (bc_continue, locus); cp_walk_tree (&OMP_FOR_BODY (stmt), cp_genericize_r, data, NULL); cp_walk_tree (&OMP_FOR_CLAUSES (stmt), cp_genericize_r, data, NULL); cp_walk_tree (&OMP_FOR_INIT (stmt), cp_genericize_r, data, NULL); cp_walk_tree (&OMP_FOR_COND (stmt), cp_genericize_r, data, NULL); cp_walk_tree (&OMP_FOR_INCR (stmt), cp_genericize_r, data, NULL); cp_walk_tree (&OMP_FOR_PRE_BODY (stmt), cp_genericize_r, data, NULL); *walk_subtrees = 0; finish_bc_block (&OMP_FOR_BODY (stmt), bc_continue, clab); }
void ubsan_maybe_instrument_reference (tree *stmt_p) { tree stmt = *stmt_p; tree op = stmt; if (TREE_CODE (stmt) == NOP_EXPR) op = TREE_OPERAND (stmt, 0); op = ubsan_maybe_instrument_reference_or_call (EXPR_LOCATION (stmt), op, TREE_TYPE (stmt), UBSAN_REF_BINDING); if (op) { if (TREE_CODE (stmt) == NOP_EXPR) TREE_OPERAND (stmt, 0) = op; else *stmt_p = op; } }
void ubsan_maybe_instrument_array_ref (tree *expr_p, bool ignore_off_by_one) { if (!ubsan_array_ref_instrumented_p (*expr_p) && do_ubsan_in_current_function ()) { tree op0 = TREE_OPERAND (*expr_p, 0); tree op1 = TREE_OPERAND (*expr_p, 1); tree e = ubsan_instrument_bounds (EXPR_LOCATION (*expr_p), op0, &op1, ignore_off_by_one); if (e != NULL_TREE) { tree t = copy_node (*expr_p); TREE_OPERAND (t, 1) = build2 (COMPOUND_EXPR, TREE_TYPE (op1), e, op1); *expr_p = t; } } }
static void genericize_for_stmt (tree *stmt_p, int *walk_subtrees, void *data) { tree stmt = *stmt_p; tree expr = NULL; tree loop; tree init = FOR_INIT_STMT (stmt); if (init) { cp_walk_tree (&init, cp_genericize_r, data, NULL); append_to_statement_list (init, &expr); } genericize_cp_loop (&loop, EXPR_LOCATION (stmt), FOR_COND (stmt), FOR_BODY (stmt), FOR_EXPR (stmt), 1, walk_subtrees, data); append_to_statement_list (loop, &expr); *stmt_p = expr; }