public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Testcase for PR40874
@ 2011-05-23 15:02 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-05-23 15:02 UTC (permalink / raw)
  To: gcc-patches


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-23 14:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 15:02 [PATCH] Testcase for PR40874 Richard Guenther

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).