summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr31959.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr31959.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr31959.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr31959.c b/gcc/testsuite/gcc.dg/pr31959.c
new file mode 100644
index 000000000..f8090f45c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr31959.c
@@ -0,0 +1,20 @@
+/* PR middle-end/31959 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -fguess-branch-probability" } */
+
+struct A { int i; };
+
+static inline struct A *
+bar (struct A *x)
+{
+ return x;
+}
+
+void *
+foo (struct A *x, int y)
+{
+ void *p = (void *) 0;
+ if (__builtin_expect (y >= 6, 0))
+ p = bar (x);
+ return p;
+}