From patchwork Thu Nov 27 14:12:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 415528 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 823841401AD for ; Fri, 28 Nov 2014 01: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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=ixV4XIk15mmftNeuvOik15+LovBFMRpOdacQ3/erIhLy4ZONKCdTI eAkxCQikA6IC26yN47bSrzqRPoSYDcWMwQSmSeC/bAuJul4IXUkOcmtXaXfkQdqu 2cQeFEnmLIZls0R88liqjUgCu9qGHGfa9IggIyX9K50y1Pnf002xmA= 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:subject:message-id:mime-version:content-type; s= default; bh=/OfQFc4UX9XT+ejK3JS4JtM2lVs=; b=l3gTERnKuxSlupkyXzss G0xu7OizyHeNWMlA4WQNwa8OKfPynSPzWBo3ey1tIYn47nYWtdFeJQ8+qrwm1a6E WFV2dmQ5odFeeYPUVVnkJ3iun0FXS27+SWfIm9UlRURZxMxyVeLdbNX/mtXnELyg j0FcMKfkBZhzVGX4c6XP8pE= Received: (qmail 11592 invoked by alias); 27 Nov 2014 14:18:56 -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 11579 invoked by uid 89); 27 Nov 2014 14:18:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 27 Nov 2014 14:18:54 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CBDB4ACF9 for ; Thu, 27 Nov 2014 14:18:51 +0000 (UTC) Date: Thu, 27 Nov 2014 15:12:35 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR64088 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2014-11-27 Richard Biener PR middle-end/64088 * fold-const.c (const_unop): Re-instantiate missing condition before calling fold_abs_const. * gcc.dg/torture/pr64088.c: New testcase. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 218121) +++ gcc/fold-const.c (working copy) @@ -1481,7 +1489,9 @@ const_unop (enum tree_code code, tree ty } case ABS_EXPR: - return fold_abs_const (arg0, type); + if (TREE_CODE (arg0) == INTEGER_CST || TREE_CODE (arg0) == REAL_CST) + return fold_abs_const (arg0, type); + break; case CONJ_EXPR: if (TREE_CODE (arg0) == COMPLEX_CST) Index: gcc/testsuite/gcc.dg/torture/pr64088.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr64088.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr64088.c (working copy) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +extern int abs (int); +extern void attenuate_curve(int*); +int a; +void +setup_tone_curves_center_boost () +{ + int b[0]; + a = 0; + for (; a < 6; a++) + { + int c = abs (a); + b[a] = c; + } + attenuate_curve (b); +}