From patchwork Tue Sep 5 08:13:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 809991 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-461454-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gwm/YbJi"; 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 3xmfcx6w1Rz9sNw for ; Tue, 5 Sep 2017 18:14:08 +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=gpbnsraYcqi50XDH5P6cnrSXABHwqpUsaZB8KUzF7m+FYZWvZns7x ZUVVLvZviE1e/b9pU1i9VxpICqAx+1Zm0yoticuhvLbdOSv7wrC+TgM3GywczJmk J11h/1HWUHAXTMf7JPnMM67TTvz8IdMzLGfOu2CQOvpOmMv1nePbQY= 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=HGKmHdYXJpnnBAy623RR7CMse1A=; b=gwm/YbJi/S9+QrwB50qp 2hiEphgQUYEAhrYLhlw912Lc4AHiGT5rIwzQkxJ2vc5NSnwe2XV/D8S/JGrViZUz qX92NazRWdcalQakV2pFj3eIb0QbjDtZ+ybLEpdSwcF6F0gzlscddqSaZeZPiPD4 aR0klAdz51DGYiTEedHXZuw= Received: (qmail 114340 invoked by alias); 5 Sep 2017 08:13:58 -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 114295 invoked by uid 89); 5 Sep 2017 08:13:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Tue, 05 Sep 2017 08:13:52 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id F24E0ABDE for ; Tue, 5 Sep 2017 08:13:49 +0000 (UTC) Date: Tue, 5 Sep 2017 10:13:49 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR82102 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes PR82102, GIMPLE_NOPs don't have a lhs so we have to care for that case. Tested on x86_64-unknown-linux-gnu, applied as obvious. Richard. 2017-09-05 Richard Biener PR tree-optimization/82102 * tree-ssa-pre.c (fini_eliminate): Check if lhs is NULL. * gcc.dg/torture/pr82102.c: New testcase. Index: gcc/tree-ssa-pre.c =================================================================== --- gcc/tree-ssa-pre.c (revision 251689) +++ gcc/tree-ssa-pre.c (working copy) @@ -4860,6 +4860,7 @@ fini_eliminate (void) lhs = gimple_get_lhs (stmt); if (inserted_exprs + && lhs && TREE_CODE (lhs) == SSA_NAME && bitmap_bit_p (inserted_exprs, SSA_NAME_VERSION (lhs))) continue; Index: gcc/testsuite/gcc.dg/torture/pr82102.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr82102.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr82102.c (working copy) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +void *a, *b; +struct pt3_i2cbuf { + int num_cmds; +} c; +void *memcpy(void *, void *, __SIZE_TYPE__); +void put_stop(); +void translate(struct pt3_i2cbuf *p1, int p2) +{ + p1->num_cmds = 0; + if (p2) + put_stop(); +} +void pt3_i2c_master_xfer(int p1) +{ + translate(&c, p1); + memcpy(a, b, c.num_cmds); + for (; p1;) + ; +}