aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/combine.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr99830.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 3294575..dffa3b0 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -10153,7 +10153,7 @@ simplify_and_const_int_1 (scalar_int_mode mode, rtx varop,
constop &= nonzero;
/* If we don't have any bits left, return zero. */
- if (constop == 0)
+ if (constop == 0 && !side_effects_p (varop))
return const0_rtx;
/* If VAROP is a NEG of something known to be zero or 1 and CONSTOP is
diff --git a/gcc/testsuite/gcc.dg/pr99830.c b/gcc/testsuite/gcc.dg/pr99830.c
new file mode 100644
index 0000000..75226f5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr99830.c
@@ -0,0 +1,10 @@
+/* PR debug/99830 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O2 -fno-expensive-optimizations -fno-split-wide-types -g" } */
+
+int foo (long a, __int128 b, short c, int d, unsigned e, __int128 f)
+{
+ __builtin_memmove (2 + (char *) &f, foo, 1);
+ c >>= (char) f;
+ return c;
+}