From patchwork Thu Nov 24 15:27:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 127537 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 08DDF1007D7 for ; Fri, 25 Nov 2011 02:27:49 +1100 (EST) Received: (qmail 5027 invoked by alias); 24 Nov 2011 15:27:47 -0000 Received: (qmail 5015 invoked by uid 22791); 24 Nov 2011 15:27:46 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Thu, 24 Nov 2011 15:27:28 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAOFRR8d005369 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Nov 2011 10:27:28 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pAOFRRI3000693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 24 Nov 2011 10:27:27 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id pAOFRQNH026985 for ; Thu, 24 Nov 2011 16:27:26 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id pAOFRQX0026983 for gcc-patches@gcc.gnu.org; Thu, 24 Nov 2011 16:27:26 +0100 Date: Thu, 24 Nov 2011 16:27:26 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Add testcase for PR rtl-optimization/50290 Message-ID: <20111124152726.GK27242@tyan-ft48-01.lab.bos.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! This PR has been fixed by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180058 This patch just adds the testcase from the PR, so it can be closed. Tested on x86_64-linux and i686-linux, committed to trunk as obvious. 2011-11-24 Jakub Jelinek PR rtl-optimization/50290 * gcc.dg/pr50290.c: New test. Jakub --- gcc/testsuite/gcc.dg/pr50290.c.jj 2011-11-24 13:41:06.516330291 +0100 +++ gcc/testsuite/gcc.dg/pr50290.c 2011-11-24 13:40:41.000000000 +0100 @@ -0,0 +1,27 @@ +/* PR rtl-optimization/50290 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-tree-loop-optimize -fno-tree-vrp -funroll-loops" } */ + +static int +bar (int t[], int b) +{ + int i; + for (i = 0; i < b; i++) + t[i] = i + (i > 0 ? t[i - 1] : 0); + return t[b - 1]; +} + +static int +foo (int b) +{ + int x[b]; + return bar (x, b); +} + +int +main () +{ + if (foo (6) != 15) + __builtin_abort (); + return 0; +}