summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr46076.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr46076.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr46076.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr46076.c b/gcc/testsuite/gcc.dg/tree-ssa/pr46076.c
new file mode 100644
index 000000000..e9dc434ec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr46076.c
@@ -0,0 +1,27 @@
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+extern void link_error (void) { /* XFAIL */ }
+
+typedef unsigned char(*Calculable)(void);
+
+static unsigned char one() { return 1; }
+static unsigned char two() { return 2; }
+
+static int
+print(Calculable calculate)
+{
+ return calculate() + calculate() + 1;
+}
+
+int
+main()
+{
+ /* Make sure we perform indirect inlining of one and two and optimize
+ the result to a constant. */
+ if (print(one) != 3)
+ link_error ();
+ if (print(two) != 5)
+ link_error ();
+ return 0;
+}