From patchwork Wed Jul 17 07:21:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1133149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-505180-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="VCm7wykh"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45pTGK6wqQz9s8m for ; Wed, 17 Jul 2019 17:21:29 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=u5ppntZGZUaLqDyuQXZdMabL+UPjYCwoMM14bVC/fVFJ2om4DRJvg riMOGrI2mIXSiTP1Px8rhZ5kg664/izM+C494e2W+zPT6h/HoVIWBBH4WiXqjIj6 ltQBWCPTBXjyGbXAZseBvCqyhOddoAW5HO2jf2syvvrs7YnPy8En+Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=idR1kA613C8/ceP9Vw4dMCcnGB8=; b=VCm7wykhAORhHtOYBHOs ta8537hlCOMb57yCQFQi9oQ9/Bvonah7qK1ilwqgb9OoqdUYeLYZvE5ExAy6kR4z 349NR5JGPYMsDISZgii9En57tSQtVHpgp4s7khbTq+yZUrBB0crYdAw7lLrGs7LI n7wbjYWGF/HL69IGuTnPEhE= Received: (qmail 19606 invoked by alias); 17 Jul 2019 07:21:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 19598 invoked by uid 89); 17 Jul 2019 07:21:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=leni X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jul 2019 07:21:21 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A74DBAD69 for ; Wed, 17 Jul 2019 07:21:19 +0000 (UTC) Date: Wed, 17 Jul 2019 09:21:19 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR91180 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes PR91180. Bootstrap / regtest running on x86_64-unknown-linux-gnu. Richard. 2019-07-17 Richard Biener PR tree-optimization/91180 * tree-ssa-sccvn.c (vn_reference_lookup_3): Fix offset computation for memset partial defs. * gcc.dg/torture/pr91180.c: New testcase. Index: gcc/tree-ssa-sccvn.c =================================================================== --- gcc/tree-ssa-sccvn.c (revision 273542) +++ gcc/tree-ssa-sccvn.c (working copy) @@ -2486,7 +2535,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree { pd_data pd; pd.rhs = build_constructor (NULL_TREE, NULL); - pd.offset = offset2i - offseti; + pd.offset = (offset2i - offseti) / BITS_PER_UNIT; pd.size = leni; return data->push_partial_def (pd, vuse, maxsizei); } Index: gcc/testsuite/gcc.dg/torture/pr91180.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr91180.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr91180.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do run } */ + +int +main () +{ +#if __SIZEOF_INT__ == 4 + unsigned x = 0xffffffff; + __builtin_memset (1 + (char *) &x, 0, 2); + if (x != 0xff0000ff) + __builtin_abort (); +#endif + return 0; +}