aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/optabs.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr103838.c28
2 files changed, 36 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 019bbb6..ca00bbd 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1135,6 +1135,10 @@ expand_doubleword_mod (machine_mode mode, rtx op0, rtx op1, bool unsignedp)
remainder = convert_modes (mode, word_mode, remainder, unsignedp);
/* Punt if we need any library calls. */
+ if (last)
+ last = NEXT_INSN (last);
+ else
+ last = get_insns ();
for (; last; last = NEXT_INSN (last))
if (CALL_P (last))
return NULL_RTX;
@@ -1228,6 +1232,10 @@ expand_doubleword_divmod (machine_mode mode, rtx op0, rtx op1, rtx *rem,
}
/* Punt if we need any library calls. */
+ if (last)
+ last = NEXT_INSN (last);
+ else
+ last = get_insns ();
for (; last; last = NEXT_INSN (last))
if (CALL_P (last))
return NULL_RTX;
diff --git a/gcc/testsuite/gcc.dg/pr103838.c b/gcc/testsuite/gcc.dg/pr103838.c
new file mode 100644
index 0000000..cde44e6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr103838.c
@@ -0,0 +1,28 @@
+/* PR debug/103838 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+#ifdef __SIZEOF_INT128__
+__int128 m;
+#else
+long long m;
+#endif
+int n;
+
+__attribute__((noinline)) void
+bar (void)
+{
+ n += !!m;
+}
+
+void
+foo (void)
+{
+ int i;
+
+ for (i = 0; i < 2; ++i)
+ {
+ bar ();
+ m /= 3;
+ }
+}