summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr48837.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr48837.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr48837.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr48837.c b/gcc/testsuite/gcc.dg/pr48837.c
new file mode 100644
index 000000000..ffc65b9dc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr48837.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/48837 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+void abort (void);
+
+__attribute__((noinline))
+int baz(void)
+{
+ return 1;
+}
+
+inline const int *bar(const int *a, const int *b)
+{
+ return *a ? a : b;
+}
+
+int foo(int a, int b)
+{
+ return a || b ? baz() : foo(*bar(&a, &b), 1) + foo(1, 0);
+}
+
+int main(void)
+{
+ if (foo(0, 0) != 2)
+ abort();
+
+ return 0;
+}
+