aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-03-09 18:43:34 -0500
committerMarek Polacek <polacek@redhat.com>2023-05-01 17:50:28 -0400
commit8d2793ef6b15dbdd347c854f663eb145af5ee593 (patch)
tree3f758a429a5bf606f9e6f6de1a771a9185287e9f
parent07c52d1eec9671af92b7ce977b469f13a87887ad (diff)
downloadgcc-8d2793ef6b15dbdd347c854f663eb145af5ee593.zip
gcc-8d2793ef6b15dbdd347c854f663eb145af5ee593.tar.gz
gcc-8d2793ef6b15dbdd347c854f663eb145af5ee593.tar.bz2
ubsan: ubsan_maybe_instrument_array_ref tweak
In <https://gcc.gnu.org/pipermail/gcc-patches/2023-March/613687.html> we discussed that the copy_node in ubsan_maybe_instrument_array_ref is redundant, but also that it'd be best to postpone the optimization to GCC 14. So I'm making that change now. gcc/c-family/ChangeLog: * c-ubsan.cc (ubsan_maybe_instrument_array_ref): Don't copy_node.
-rw-r--r--gcc/c-family/c-ubsan.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/c-family/c-ubsan.cc b/gcc/c-family/c-ubsan.cc
index c3ae515..cfb7cbf 100644
--- a/gcc/c-family/c-ubsan.cc
+++ b/gcc/c-family/c-ubsan.cc
@@ -505,12 +505,8 @@ ubsan_maybe_instrument_array_ref (tree *expr_p, bool ignore_off_by_one)
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;
- }
+ TREE_OPERAND (*expr_p, 1) = build2 (COMPOUND_EXPR, TREE_TYPE (op1),
+ e, op1);
}
}