aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr89795.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr89795.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr89795.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr89795.c b/gcc/testsuite/gcc.dg/pr89795.c
new file mode 100644
index 00000000000..4ceaa433f3c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr89795.c
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/89795 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-dce -fno-forward-propagate -fno-sched-pressure" } */
+
+unsigned char a;
+unsigned b, c, d;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8
+ unsigned x;
+ int e, f;
+ unsigned char g;
+ e = __builtin_bswap32 (a);
+ f = __builtin_ffs (~(unsigned short) e);
+ a = __builtin_mul_overflow ((unsigned char) 0xf7, f, &g);
+ a |= __builtin_sub_overflow_p (c, 0, (unsigned char) 0);
+ d = g + b;
+ x = d;
+ if (x != 0xf7)
+ __builtin_abort ();
+#endif
+ return 0;
+}