From patchwork Thu Jul 14 15:28:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 648439 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3rr02t5hFMz9s5M for ; Fri, 15 Jul 2016 01:28:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=aguNs7eL; dkim-atps=neutral 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:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=LPbGXVWXUHGTIcs1KUHPpEyyu5q2m UrOs0ORqZ0kXyulplGUQW13yqYwuzAJNQ4ekKjPItCrZay4+aTGttFyQ895tGHro PSU6sV86abPKiyAKSFN1fXjjSmgRhV5WtqzYFN8FupS2uwOVxicObUOtXhHW+xkI +QoCEJ9vtw31Jo= 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:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=dELk1BhmDFpaEA+GIAxL6izLB00=; b=agu Ns7eLqpYyjV7alVuu0gUpM9t2bObca/aH25ezkkO/Rf2jG2QhNsYZB+MaYkz6ZK5 DmgauQRclmSwF9o8j7mhv84vWKxMtS9VhlzZHQhy7YfCyBCrW9vM0euXifShYTvo 87MUFrlKyIlL7m9Oioa5yeXqGCoGhHg1ZyyX/UdU= Received: (qmail 95124 invoked by alias); 14 Jul 2016 15:28:10 -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 94223 invoked by uid 89); 14 Jul 2016 15:28:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1, 15 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 14 Jul 2016 15:28:08 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 447C4C049D52; Thu, 14 Jul 2016 15:28:07 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-98.brq.redhat.com [10.40.204.98]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6EFS5Gr020278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 14 Jul 2016 11:28:06 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u6EFS4pM028081; Thu, 14 Jul 2016 17:28:04 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u6EFS3ML028080; Thu, 14 Jul 2016 17:28:03 +0200 Date: Thu, 14 Jul 2016 17:28:03 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix tree-data-ref.c ICE (PR tree-optimization/71872) Message-ID: <20160714152803.GI7387@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! As mentioned in the PR, we ICE on the following testcase, because tree-data-ref.c for VIEW_CONVERT_EXPR(0) attempts to create ADDR_EXPR of INTEGER_CST, which is not really valid. I've successfully bootstrapped/regtested earlier version of this patch with is_gimple_constant instead of is_gimple_min_invariant on x86_64-linux and i686-linux, ok for trunk if even this version succeeds? 2016-07-14 Jakub Jelinek PR tree-optimization/71872 * tree-data-ref.c (get_references_in_stmt): Ignore references with is_gimple_constant get_base_address. * gcc.c-torture/compile/pr71872.c: New test. Jakub --- gcc/tree-data-ref.c.jj 2016-07-11 22:18:08.000000000 +0200 +++ gcc/tree-data-ref.c 2016-07-14 14:03:57.902899566 +0200 @@ -3868,7 +3868,8 @@ get_references_in_stmt (gimple *stmt, ve if (DECL_P (op1) || (REFERENCE_CLASS_P (op1) && (base = get_base_address (op1)) - && TREE_CODE (base) != SSA_NAME)) + && TREE_CODE (base) != SSA_NAME + && !is_gimple_min_invariant (base))) { ref.ref = op1; ref.is_read = true; --- gcc/testsuite/gcc.c-torture/compile/pr71872.c.jj 2016-07-14 14:14:17.132889043 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr71872.c 2016-07-14 14:14:05.000000000 +0200 @@ -0,0 +1,15 @@ +/* PR tree-optimization/71872 */ + +struct __attribute__((may_alias)) S { int a; }; + +void +foo (int *x, struct S *y) +{ + int i; + for (i = 0; i < 16; i++) + { + int a = 0; + if (*x) + *(struct S *) y = *(struct S *) &a; + } +}