From patchwork Wed Aug 10 13:47:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 462 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:20da:b0:2d3:3019:e567 with SMTP id n26csp3181702pxc; Wed, 10 Aug 2022 06:47:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR6MZNp4VHNiwEv+icvfXe20mXIYWUoyBdKaGT+1wS+Udf8dl1wU5qk0dex8gKqWoOolT565 X-Received: by 2002:a17:907:2bf9:b0:730:7a66:71a3 with SMTP id gv57-20020a1709072bf900b007307a6671a3mr19403611ejc.623.1660139277125; Wed, 10 Aug 2022 06:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660139277; cv=none; d=google.com; s=arc-20160816; b=DrsOSAKq/SJRwyVJqLr2T/Fdsqq7llT0s5SajotOokiQxUal2/oIwWFM1HM+/sWvyf l6ISGOCuB2vtVMTqtn+x7GvBa00ZpCIT4Btbellx3ONiFoJ5KH9/QZ24IDJ6CKIVjkkH SxaRDGsFce8XcXM/lpHgZE3S8SnxBoA8CSBnR/oIRTqne7YW2NGn6tSQpr3UP+IcKw5z RQgAgBhRYtn/5xx8uFqjIVU3m/lmtwcbrKAuN3QesDvO8U3uogq1nWM0kTW9LPxBliIE 3te8w5ib2d9X9KmOon+Gy9jyb/2djyk/3OGmtuvlw4kYIcF5YaUNhaQjuG9W/4iSbBE7 SMaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id :mime-version:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=Gyj1QXNeDURrO6F3ythVcanI0bKvuctxgl0MXASA+FA=; b=XldhC/5dkKUg2s5kodHO6bhX8fbLffZu/kYYeoLz5Ath5DO9B+StMUHt3jAaJk6Nk5 SqzePKnvz1GNEqALHiQX3JXsUBtvGefcmSwg5RT7IaNFJkbpdBP68v14+ps2O3jfUVcZ xNEg1LyUMpM0TicidnqZRrCJ9CVa4aogRpqjOKza77Xvtcqt21f34cvaGVb+mLgrPG9o sia6dvncK+u9Z8yJl53LPvc5sSMWVjUDCMoQkmiB4ybaQAPh4e/pdz7jlvOB1mvwufM8 YFurhdzC9tZ96E0cHT8f5genr3dHC3KDeAL8f5bPcCw9IRlcUZ44qFTznpBMMnMutZ2C o8OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="HvH/RzQX"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t15-20020a056402524f00b0043c891e0f0fsi12288850edd.356.2022.08.10.06.47.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 06:47:57 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="HvH/RzQX"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7667C385AC27 for ; Wed, 10 Aug 2022 13:47:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7667C385AC27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1660139275; bh=Gyj1QXNeDURrO6F3ythVcanI0bKvuctxgl0MXASA+FA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=HvH/RzQXnyZqZ/rOQfC5Co1ug9583ds7EC3I25o2WdyjW71XLBjgMS/sHCCeJIlG1 mpuCWP5m388Tzqia3P3t7t8Y6crlTMlwcI3pHqf8eRqqXWi0p9zqyWe4njgG5QOPi3 t1+yIZf7j+0O3hmoDpQJan53r6bh7Ro5LcONJbEc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 7D2F4385840B for ; Wed, 10 Aug 2022 13:47:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D2F4385840B Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 664EA38272 for ; Wed, 10 Aug 2022 13:47:11 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 51ABC13AB3 for ; Wed, 10 Aug 2022 13:47:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id /JmdEt+282KOIQAAMHmgww (envelope-from ) for ; Wed, 10 Aug 2022 13:47:11 +0000 Date: Wed, 10 Aug 2022 15:47:10 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/106513 - fix mistake in bswap symbolic number shifts MIME-Version: 1.0 Message-Id: <20220810134711.51ABC13AB3@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1740782202407122143?= X-GMAIL-MSGID: =?utf-8?q?1740782202407122143?= This fixes a mistake in typing a local variable in the symbolic shift routine. Bootstrap & regtest pending on x86_64-unknown-linux-gnu. PR tree-optimization/106513 * gimple-ssa-store-merging.cc (do_shift_rotate): Use uint64_t for head_marker. * gcc.dg/torture/pr106513.c: New testcase. --- gcc/gimple-ssa-store-merging.cc | 2 +- gcc/testsuite/gcc.dg/torture/pr106513.c | 26 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr106513.c diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc index 0640168bcc4..b80b8eac444 100644 --- a/gcc/gimple-ssa-store-merging.cc +++ b/gcc/gimple-ssa-store-merging.cc @@ -263,7 +263,7 @@ do_shift_rotate (enum tree_code code, int count) { int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; - unsigned head_marker; + uint64_t head_marker; if (count < 0 || count >= TYPE_PRECISION (n->type) diff --git a/gcc/testsuite/gcc.dg/torture/pr106513.c b/gcc/testsuite/gcc.dg/torture/pr106513.c new file mode 100644 index 00000000000..92c02ffb37b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr106513.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ + +typedef __INT64_TYPE__ int64_t; + +__attribute__((noinline)) int64_t +swap64 (int64_t n) +{ + return (((n & (((int64_t) 0xff) )) << 56) | + ((n & (((int64_t) 0xff) << 8)) << 40) | + ((n & (((int64_t) 0xff) << 16)) << 24) | + ((n & (((int64_t) 0xff) << 24)) << 8) | + ((n & (((int64_t) 0xff) << 32)) >> 8) | + ((n & (((int64_t) 0xff) << 40)) >> 24) | + ((n & (((int64_t) 0xff) << 48)) >> 40) | + ((n & ((int64_t)(0xffull << 56))) >> 56)); +} + +int main (void) +{ + volatile int64_t n = 0x8000000000000000l; + + if (swap64(n) != 0xffffffffffffff80l) + __builtin_abort (); + + return 0; +}