From patchwork Mon May 23 14:34:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 96948 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 68ED9B6F95 for ; Tue, 24 May 2011 00:34:26 +1000 (EST) Received: (qmail 17133 invoked by alias); 23 May 2011 14:34:24 -0000 Received: (qmail 17098 invoked by uid 22791); 23 May 2011 14:34:23 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 May 2011 14:34:09 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 2BD798F29D for ; Mon, 23 May 2011 16:34:08 +0200 (CEST) Date: Mon, 23 May 2011 16:34:08 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Testcase for PR40874 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 Committed. 2011-05-23 Richard Guenther PR tree-optimization/40874 * g++.dg/tree-ssa/pr40874.C: New testcase. Index: gcc/testsuite/g++.dg/tree-ssa/pr40874.C =================================================================== --- gcc/testsuite/g++.dg/tree-ssa/pr40874.C (revision 0) +++ gcc/testsuite/g++.dg/tree-ssa/pr40874.C (revision 0) @@ -0,0 +1,25 @@ +// { dg-do compile } +// { dg-options "-O -fdump-tree-optimized" } + +struct pf +{ + inline pf(int(*x)(int)) : x(x) {} + + inline int operator()(int a) const + { + return x(a); + } + + int (*x)(int); +}; + +inline int g(int x) { return x/x - 1; } + +int main(int argc, char* argv[]) +{ + pf f(g); + return f(3); +} + +// { dg-final { scan-tree-dump "return 0" "optimized" } } +// { dg-final { cleanup-tree-dump "optimized" } }