public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Testcase for PR40874
Date: Mon, 23 May 2011 15:02:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1105231633500.810@zhemvz.fhfr.qr> (raw)


Committed.

2011-05-23  Richard Guenther  <rguenther@suse.de>

	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" } }

                 reply	other threads:[~2011-05-23 14:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1105231633500.810@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).