From patchwork Mon Jan 7 21:03:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 210239 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]) by ozlabs.org (Postfix) with SMTP id 4C95D2C0087 for ; Tue, 8 Jan 2013 08:04:08 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358197448; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=KOcU8efp1cryUrK1bM4i Gb/ILyo=; b=sHNXfBff005Q9KRA4FQxPBMgCq1Boq1IdOW9lEieX0/WQV+oLCQA I/Ndt8eTD/QjizxQob3zipXfJV60UPnyNfhDFRBYIhNzVksOBukfCksj8y7iUV1Q 06ge+46JLq9vACwAhXDfHfZXWw8MK5WStrEWbOiHjMLiuvGaW2BdKVo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=vlPlo3Iu6b4zmYpUR0SnILwDSCEONsyQDC3lt0HQMvHQi7NFLgjs0GDDng40JS gc4LfZrTxOhl4JGAloOxMhQW8VKcE57FFt61HUobFPI5R8gvXv1dRQakluHQ6XsT ncp0Ymv3b/pcAO0kliew/lR23AUQXab2rKmm8KmK9CyGA=; Received: (qmail 5653 invoked by alias); 7 Jan 2013 21:04:02 -0000 Received: (qmail 5642 invoked by uid 22791); 7 Jan 2013 21:04:01 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_FN, TW_TM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Jan 2013 21:03:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r07L3uA8016273 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 Jan 2013 16:03:56 -0500 Received: from zalov.redhat.com (vpn1-4-27.ams2.redhat.com [10.36.4.27]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r07L3sht023018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 7 Jan 2013 16:03:56 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id r07L3swp023747; Mon, 7 Jan 2013 22:03:54 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r07L3rfS023746; Mon, 7 Jan 2013 22:03:53 +0100 Date: Mon, 7 Jan 2013 22:03:53 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Another non-prototype builtin issue (PR middle-end/55890) Message-ID: <20130107210353.GH7269@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi! evaluate_stmt can be crashed similarly to what you've fixed today. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-01-07 Jakub Jelinek PR middle-end/55890 * tree-ssa-ccp.c (evaluate_stmt): Use gimple_call_builtin_p. * gcc.dg/torture/pr55890-3.c: New test. Jakub --- gcc/tree-ssa-ccp.c.jj 2012-11-19 14:41:17.000000000 +0100 +++ gcc/tree-ssa-ccp.c 2013-01-07 18:53:39.952854381 +0100 @@ -1546,7 +1546,6 @@ evaluate_stmt (gimple stmt) && !is_constant) { enum gimple_code code = gimple_code (stmt); - tree fndecl; val.lattice_val = VARYING; val.value = NULL_TREE; val.mask = double_int_minus_one; @@ -1593,10 +1592,9 @@ evaluate_stmt (gimple stmt) || POINTER_TYPE_P (TREE_TYPE (rhs1))) val = bit_value_binop (code, TREE_TYPE (rhs1), rhs1, rhs2); } - else if (code == GIMPLE_CALL - && (fndecl = gimple_call_fndecl (stmt)) - && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL) + else if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)) { + tree fndecl = gimple_call_fndecl (stmt); switch (DECL_FUNCTION_CODE (fndecl)) { case BUILT_IN_MALLOC: --- gcc/testsuite/gcc.dg/torture/pr55890-3.c.jj 2013-01-07 18:51:27.415614201 +0100 +++ gcc/testsuite/gcc.dg/torture/pr55890-3.c 2013-01-07 18:51:22.864640151 +0100 @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +void *memmove (); + +void * +bar () +{ + return memmove (); +}