From patchwork Mon Nov 11 20:18:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1193111 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-513001-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="gXl/rjSH"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="FZYN+Jgr"; 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 47Bhz21Wfgz9s4Y for ; Tue, 12 Nov 2019 07:18:38 +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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=CQi 5h8LK6Qh1EDyhKQbMWfXHTSAl31u0UlprwmSP3YVJo9cmFU3irOCQnbrfENKD8Ru v91v+j7KGJ991AsHi3pQpeQGf729K4Z3pB26EagfiI/4MxPLHJEFhxuhbaF1SglK Zo0iIekE+v00bJ7d+8p1951acUGSxp90ykYOgiv0= 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:content-transfer-encoding; s=default; bh=GcafAq7sc zRVY3Ejjr201WeS3xM=; b=gXl/rjSHQer4g/aOWN+4oElsbWCRaOgaDofEiNPmf Z9OTMghlGQbWFqfG8XOgcCNRC3KLz8FPuaQJ+tC+9fHUK9MijkQcfScJ2VMifnv5 uMSCtbivx42GzM4g/fTSu+IMxbOq9BCmBJU7bJB4SrGqXKvKQgo5ZEQx+yXWLwx6 xM= Received: (qmail 119171 invoked by alias); 11 Nov 2019 20:18:31 -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 119162 invoked by uid 89); 11 Nov 2019 20:18:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2019 20:18:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573503508; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lZG/FjfUXDQ9JdnzTzs8RjyhDslj0r6B5RHURXjBefs=; b=FZYN+JgrOGjrX0Nc57BoifGctF4p8wykUTaifstB5pIOuiNSw9FuVt+aF22UF/qgdx/E/V bGy2remavo9SnhKTMc7A5jD848WpGNdrSY8fHqrhCMOOYmCSgV2B+6VNQarBH0Xq9IyWLV pXzVeNgqzv3lgF7PgxrN86blETPpPJw= 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-43-qr3qxTGNPmWN7refG_jt1Q-1; Mon, 11 Nov 2019 15:18:22 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3CD74107ACC5; Mon, 11 Nov 2019 20:18:21 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.36.118.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF6BA5C1D8; Mon, 11 Nov 2019 20:18:20 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id xABKII9H026631; Mon, 11 Nov 2019 21:18:18 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id xABKIGAS026630; Mon, 11 Nov 2019 21:18:16 +0100 Date: Mon, 11 Nov 2019 21:18:16 +0100 From: Jakub Jelinek To: Richard Biener , Jeff Law , Richard Sandiford Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICE in vrp on aarch64 (PR tree-optimization/92452) Message-ID: <20191111201816.GB4650@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 Content-Disposition: inline X-IsSubscribed: yes Hi! The following testcase ICEs on aarch64-linux. The problem is that maxbound is POLY_INT_CST, eltsize is INTEGER_CST, but int_const_binop for TRUNC_DIV_EXPR returns NULL_TREE as it can't simplify it to something usable and we later try to MINUS_EXPR the NULL_TREE. Fixed thusly, tested using cross to aarch64-linux, bootstrapped/regtested on powerpc64le-linux, ok for trunk? 2019-11-11 Jakub Jelinek PR tree-optimization/92452 * tree-vrp.c (vrp_prop::check_array_ref): If TRUNC_DIV_EXPR folds into NULL_TREE, set up_bound to NULL_TREE instead of computing MINUS_EXPR on it. * c-c++-common/pr92452.c: New test. Jakub --- gcc/tree-vrp.c.jj 2019-11-09 00:41:09.022921760 +0100 +++ gcc/tree-vrp.c 2019-11-11 17:03:36.844669691 +0100 @@ -4150,8 +4150,11 @@ vrp_prop::check_array_ref (location_t lo up_bound_p1 = int_const_binop (TRUNC_DIV_EXPR, maxbound, eltsize); - up_bound = int_const_binop (MINUS_EXPR, up_bound_p1, - build_int_cst (ptrdiff_type_node, 1)); + if (up_bound_p1 != NULL_TREE) + up_bound = int_const_binop (MINUS_EXPR, up_bound_p1, + build_int_cst (ptrdiff_type_node, 1)); + else + up_bound = NULL_TREE; } } else --- gcc/testsuite/c-c++-common/pr92452.c.jj 2019-11-11 17:06:01.525495277 +0100 +++ gcc/testsuite/c-c++-common/pr92452.c 2019-11-11 17:05:31.256950180 +0100 @@ -0,0 +1,5 @@ +/* PR tree-optimization/92452 */ +/* { dg-do compile } */ +/* { dg-options "-Os -Warray-bounds=1" } */ + +#include "pr60101.c"