From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 52AFB3858D1E for ; Mon, 1 May 2023 21:51:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52AFB3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682977878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AtOgJReKkBt7Cf2LbamIVkbn8bCCaAz2sf1WJembMGQ=; b=VvrwbOvDXNm6g4ZalgTO+RiVjqA1o3zpBH1vsNhHbHwGYT2nscKxkuYulEJNLYb5aLRH5i XwaxRiOJxOCb4Z8MT1beZcvwzTORvZemz+H8Makk+yxpu+Yxl4tC4ugl7Fl7GegXF1lCWF QJluB4teZe4Srj5yGEuJaA273DWplzU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-171-Us9DtaCiNoOk75cTMVbl8Q-1; Mon, 01 May 2023 17:51:17 -0400 X-MC-Unique: Us9DtaCiNoOk75cTMVbl8Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53205811E7D for ; Mon, 1 May 2023 21:51:17 +0000 (UTC) Received: from pdp-11.lan (unknown [10.22.10.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D3AF40B3EDA for ; Mon, 1 May 2023 21:51:17 +0000 (UTC) From: Marek Polacek To: GCC Patches Subject: [pushed] ubsan: ubsan_maybe_instrument_array_ref tweak Date: Mon, 1 May 2023 17:51:12 -0400 Message-Id: <20230501215112.432409-1-polacek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: In 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. Tested x86_64-pc-linux-gnu, applying to trunk. gcc/c-family/ChangeLog: * c-ubsan.cc (ubsan_maybe_instrument_array_ref): Don't copy_node. --- 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); } } base-commit: 07c52d1eec9671af92b7ce977b469f13a87887ad -- 2.40.1