From patchwork Fri Jul 12 19:14:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1960013 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=eJP3pygF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WLLr85wlrz1xqj for ; Sat, 13 Jul 2024 05:14:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D9E203842FEE for ; Fri, 12 Jul 2024 19:14:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id A01B43842FEE for ; Fri, 12 Jul 2024 19:14:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A01B43842FEE Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ventanamicro.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A01B43842FEE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::231 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720811646; cv=none; b=jSdHMBmg44CHilkkv0UQEmDyPmditX8vCI0eH5pf9hVxcuJFT5JRZK+FIm0LeN+7rNbvxwR9gPsPlNikOf3nUt2dw1pArBtEaE/IoGItKwVJHbQ0gF+Lj7+YAX1YWSWMDJE9c9k20uMMazQFkxvZHwXX6vKZApnOxr39UEvq9fc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720811646; c=relaxed/simple; bh=jS0GowDgU+gTdvEvzQAjl+KqW6oyW5CA+hveeHad9eI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=JVHJtnLyPUBUOFRfiRzUrt2jhh8SIlCNpIOWii71VLMZoxk2zZoCmCo/eimMWe4sT4oyBZNodyoJJs7K5F6DCtidcPt8v4BjpJpuSLGexScLciIrlzCbmCL6u25ZJx4kq6pQKa7FAdH7ILDY+3JG3jf5cd0f4V3Su3fsTGOc8+E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3d92df7e83cso1464504b6e.0 for ; Fri, 12 Jul 2024 12:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1720811644; x=1721416444; darn=gcc.gnu.org; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=LfZ/V0ekjj6wRjD7IOZ1E9r+uSGCF06hZIu6B8sQPkU=; b=eJP3pygF0MNEIW2pQBsxKEXKNUojvIrTqaF+3mpO0X7S70iICSxFaSX4chMCfRkaBO nr4xs5MvLNvwKg6K/LKGu4QNgMAjAA5zuxZKOzFpr2HQTkIVoB0GrLENpDJqogGEpoVE 0IWV89kk8dH9zCRQ12WANAEqCEGwMP5bTow8PH+IpoG8DMH41FDt+W69wK9nerQqd+pp LxR9tFDrmVEw+/ykwevHWnN4YG2rCyAvbsCf+Jy5mzb5upQakFclPRF9PCbK9LHbVZo0 CMnjpYM/QFK6YcDjkEBHIYV3sz+7u8STLFG8XJ2bsMzPJJKGReo6mPx7MNlFgW4InpJ8 vWpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720811644; x=1721416444; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LfZ/V0ekjj6wRjD7IOZ1E9r+uSGCF06hZIu6B8sQPkU=; b=wP+VeRsBANzA57BI09wNK31c+yzsvSlUPJdkEik5h/BfLxpiL39WX/0YlUOlezLSlD 02+4Lrp2bRyXce1VuKOpAfGmn9Mgmi1ST81dm/JA1GZ+yvyTA6I/5NK2QIyz2MXkI7Ip 8e8ksmVfJElvD1UdMAL2W+rP1hg/hMamYxRmMnx9hpVuWH+EpopQswKT1pcTay2AM93I TIguzQ4DdWPUFv0VeIjiPblo6VbKtvQWfdEu7WMlO/89OkZNFpFx2y3M/CXLnAV//76G d0B9Eu1qvU69zmxaDTapfvwjCS9NyVTN7AhrDm+FvclXvfpOscOTyyJUiWGB3iyA4i5L K3yw== X-Gm-Message-State: AOJu0YzJEW4A75NjzwNVKGZQB4LzjxHAUBgzUArffAL9nOrE2ch6TrGs tknP+DkSZsCV8fzAFPH7+hhmf7IM/zdHvGihoywv7UDitsKC7S9Sb2X5qGA1W/CjhZE1j/YWOBO D X-Google-Smtp-Source: AGHT+IGqKKJ6vy4ZlQ+m36hujCzTuX8k8j0ASKxMv5NzaFXII0lt8RJOeG9DI4DXk8TSg7GJX+nelQ== X-Received: by 2002:aca:1103:0:b0:3d9:404c:a0cc with SMTP id 5614622812f47-3daa98ca27fmr1448665b6e.26.1720811644402; Fri, 12 Jul 2024 12:14:04 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3daa3668080sm571512b6e.39.2024.07.12.12.14.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jul 2024 12:14:03 -0700 (PDT) Message-ID: Date: Fri, 12 Jul 2024 13:14:02 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Content-Language: en-US To: "gcc-patches@gcc.gnu.org" From: Jeff Law Subject: [committed][PR rtl-optimization/115876] Fix one of two ubsan reported issues in new ext-dce.cc code X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org David Binderman did a bootstrap build with ubsan enabled which triggered a few errors in the new ext-dce.cc code. This fixes the trivial case of shifting negative values. Bootstrapped and regression tested on x86. Pushing to the trunk. Jeff PR rtl-optimization/115876 * ext-dce.cc (carry_backpropagate): Make mask and mmask unsigned. diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc index adc9084df57..91789d283fc 100644 --- a/gcc/ext-dce.cc +++ b/gcc/ext-dce.cc @@ -374,13 +374,13 @@ binop_implies_op2_fully_live (rtx_code code) exclusively pertain to the first operand. */ HOST_WIDE_INT -carry_backpropagate (HOST_WIDE_INT mask, enum rtx_code code, rtx x) +carry_backpropagate (unsigned HOST_WIDE_INT mask, enum rtx_code code, rtx x) { if (mask == 0) return 0; enum machine_mode mode = GET_MODE_INNER (GET_MODE (x)); - HOST_WIDE_INT mmask = GET_MODE_MASK (mode); + unsigned HOST_WIDE_INT mmask = GET_MODE_MASK (mode); switch (code) { case PLUS: