public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marek Polacek <mpolacek@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-387] ubsan: ubsan_maybe_instrument_array_ref tweak
Date: Mon,  1 May 2023 21:52:00 +0000 (GMT)	[thread overview]
Message-ID: <20230501215200.D73513858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:8d2793ef6b15dbdd347c854f663eb145af5ee593

commit r14-387-g8d2793ef6b15dbdd347c854f663eb145af5ee593
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Mar 9 18:43:34 2023 -0500

    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.

Diff:
---
 gcc/c-family/c-ubsan.cc | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/gcc/c-family/c-ubsan.cc b/gcc/c-family/c-ubsan.cc
index c3ae515306c..cfb7cbf389c 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);
     }
 }

                 reply	other threads:[~2023-05-01 21:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230501215200.D73513858D1E@sourceware.org \
    --to=mpolacek@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).