From patchwork Tue May 21 15:03:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 245319 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D0BE62C0091 for ; Wed, 22 May 2013 01:03:33 +1000 (EST) 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=rP3VzG6QbiD7uQ4z56GLCMaRpvGkN 5r0BW1fjeNtrJCs3NTBsT7YHeN+sbd07cAUlvM0z/nKntL8ahrNgiD9EuQOGtd3/ 1Bc4Q48iIc1Ftq9g3r4lcIlRJ+RbB/VBXFi0m6LlXqSnbJ7/MWp6jW2VOv9EemcZ PfHsjvTG8oWclQ= 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=v4oTK4hTX+9NsOZmurHWPtQ9PVg=; b=ERG 6pMqCYvYaYDDslN4/XZtUsg/9bwX4F12Fbvr07386GGXGvzNHfSWfUwG9y96flyA +25eg61LQ/HV4M5bH+RA+ISmsh/vte82j0zlea+LATW0EeKqZvGI8RxNXNt2kZIY gVPZa9MmHwUj+mqXjcNt72k39YlKhLUJ/gwjsDPc= Received: (qmail 27362 invoked by alias); 21 May 2013 15:03:26 -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 27352 invoked by uid 89); 21 May 2013 15:03:26 -0000 X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 21 May 2013 15:03:25 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4LF3NZR008044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 May 2013 11:03:24 -0400 Received: from zalov.cz (vpn-49-15.rdu2.redhat.com [10.10.49.15]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4LF3MqP009663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 May 2013 11:03:23 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r4LF3KWp015121; Tue, 21 May 2013 17:03:21 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r4LF3JDU015120; Tue, 21 May 2013 17:03:19 +0200 Date: Tue, 21 May 2013 17:03:18 +0200 From: Jakub Jelinek To: Richard Biener , Jeff Law Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix simplify_cond_using_ranges ICE (PR tree-optimization/57331) Message-ID: <20130521150318.GX1377@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi! int_fits_type_p ICEs if the second argument is pointer type (those don't have TYPE_MIN_VALUE/TYPE_MAX_VALUE). Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-05-21 Jakub Jelinek PR tree-optimization/57331 * tree-vrp.c (simplify_cond_using_ranges): Don't optimize comparison of conversion from pointer type to integral type with integer. * gcc.c-torture/compile/pr57331.c: New test. Jakub --- gcc/tree-vrp.c.jj 2013-05-04 14:35:01.000000000 +0200 +++ gcc/tree-vrp.c 2013-05-21 12:07:33.382917422 +0200 @@ -8661,7 +8661,8 @@ simplify_cond_using_ranges (gimple stmt) innerop = gimple_assign_rhs1 (def_stmt); - if (TREE_CODE (innerop) == SSA_NAME) + if (TREE_CODE (innerop) == SSA_NAME + && !POINTER_TYPE_P (TREE_TYPE (innerop))) { value_range_t *vr = get_value_range (innerop); --- gcc/testsuite/gcc.c-torture/compile/pr57331.c.jj 2013-05-21 12:08:11.859697048 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr57331.c 2013-05-21 12:06:27.000000000 +0200 @@ -0,0 +1,11 @@ +/* PR tree-optimization/57331 */ + +int +foo (int x) +{ + void *p = x ? (void *) 1 : (void *) 0; + __INTPTR_TYPE__ b = (__INTPTR_TYPE__) p; + if (b) + return 0; + return 1; +}