From patchwork Mon Nov 18 22:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sebor X-Patchwork-Id: 1197043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513969-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="j/GRsylm"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="inoifYkf"; 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 47H3Jn2gZtz9sPJ for ; Tue, 19 Nov 2019 09:19:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=ESIq+Ykt8W3lv5gewo8+6zyJArvhzQxm+GXeJKluMxR/PEAKyi vJ7OsIy7wBr3BEnWvcTevLHBjT+CKZO11Z8cFXRWwvmGFh+js3qY2QMIx2vDvMdi UMKhJpAyrTMZCNmNLzYAWedZA9n1Fu1nf+LocRx4mXY/KFMxNECVamZCk= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Aem65W2QU3mZH9snyrhO95QVsgY=; b=j/GRsylmTlZEeAuQYwxa C37iJ/LO8gUYHpfLZ6zmOzPzEYuvz1hsePi0a6v68fB+coqFHkpncVPKMOw8hHkN viIaIGTtCoaUlDxF4xM9m5VFUTgAMgIlPrqpS+jTYV/z9pZ8lzqPZ7AMuehMSnIT Iw4LQZj4WBrj8c7KXOEc+YA= Received: (qmail 113672 invoked by alias); 18 Nov 2019 22:18:57 -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 113664 invoked by uid 89); 18 Nov 2019 22:18:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 18 Nov 2019 22:18:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574115534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=RO8PMd3Gz5cnGuh5NwKBAIk2tOWxX1kZcPXJAcwYvmI=; b=inoifYkfzKygTypZiUsE/vtp6ygHx2wLja4xzbXxTAxL8Dt3ArlTdd2hDs45Cs1q28QWEF BasNggAI3fsq4HlDK6PwjvNrhxWBvsRaMp+kWeg8y5IDiNAy6zn8RH5BcgxEMjtyzXEZET BmUj07v9Fdb0ofrOPTn5TvKewN9MYYs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-KfvRO34kMYuEiY9HtUy5lA-1; Mon, 18 Nov 2019 17:18:52 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D97C477 for ; Mon, 18 Nov 2019 22:18:51 +0000 (UTC) Received: from [10.3.117.82] (ovpn-117-82.phx2.redhat.com [10.3.117.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F57760BE0 for ; Mon, 18 Nov 2019 22:18:51 +0000 (UTC) To: gcc-patches From: Martin Sebor Subject: [committed] remove spurious assignment to avoid ICE (PR 92493) Message-ID: <3e1a5e40-601b-9942-6c29-980a9fdf16c8@redhat.com> Date: Mon, 18 Nov 2019 15:18:50 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 I checked in the attached change in r278423 to avoid the ICE reported in the PR and introduced in a recent commit of mine. The change was bootstrapped and regtested on x86_64-linux. Martin PR middle-end/92493 - ICE in get_origin_and_offset at gimple-ssa-sprintf.c gcc/ChangeLog: PR tree-optimization/92493 * gimple-ssa-sprintf.c (get_origin_and_offset): Remove spurious assignment. gcc/testsuite/ChangeLog: PR tree-optimization/92493 * gcc.dg/pr92493.c: New test. Index: gcc/gimple-ssa-sprintf.c =================================================================== --- gcc/gimple-ssa-sprintf.c (revision 278418) +++ gcc/gimple-ssa-sprintf.c (working copy) @@ -2346,7 +2346,6 @@ get_origin_and_offset (tree x, HOST_WIDE_INT *fldo { *fldoff += index; *off -= index; - fldoff = NULL; } } Index: gcc/testsuite/gcc.dg/pr92493.c =================================================================== --- gcc/testsuite/gcc.dg/pr92493.c (nonexistent) +++ gcc/testsuite/gcc.dg/pr92493.c (working copy) @@ -0,0 +1,29 @@ +/* PR middle-end/92493 - ICE in get_origin_and_offset at gimple-ssa-sprintf.c + { dg-do compile } + { dg-options "-O3 -Wall" } */ + +struct A +{ + int i; + char a[2]; +} *p; + +struct B +{ + short j; + struct A a; +} b; + +void warn (int j) +{ + struct A *q = &b.a; + p = q + j; + __builtin_snprintf (p->a, 8, "%s", p->a); // { dg-warning "\\\[-Wrestrict" } +} + +void nowarn (char *d, int j) +{ + struct A *q = &b.a; + p = q + j; + __builtin_snprintf (d, 8, "%s", p->a); +}