]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/84860 (ICE in emit_move_insn, at expr.c:3717)
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 20:41:55 +0000 (22:41 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 20:41:55 +0000 (22:41 +0200)
Backported from mainline
2018-03-15  Jakub Jelinek  <jakub@redhat.com>

PR target/84860
* optabs.c (emit_conditional_move): Pass address of cmode's copy
rather than address of cmode as last argument to prepare_cmp_insn.

* gcc.c-torture/compile/pr84860.c: New test.

From-SVN: r261923

gcc/ChangeLog
gcc/optabs.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr84860.c [new file with mode: 0644]

index 841815df05acacda50c6391681bd2f241aa0f9da..65c140f5a22bc0e743b3ea4a5b2374a5eb4d4940 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84860
+       * optabs.c (emit_conditional_move): Pass address of cmode's copy
+       rather than address of cmode as last argument to prepare_cmp_insn.
+
        2018-03-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/84834
index 714fac76f3cd01d17c0851fa9df16f59a8e40bfd..9591adaae0ce4e1a76249d673f3d6772690837af 100644 (file)
@@ -4294,9 +4294,10 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
          save_pending_stack_adjust (&save);
          last = get_last_insn ();
          do_pending_stack_adjust ();
+         machine_mode cmpmode = cmode;
          prepare_cmp_insn (XEXP (comparison, 0), XEXP (comparison, 1),
                            GET_CODE (comparison), NULL_RTX, unsignedp,
-                           OPTAB_WIDEN, &comparison, &cmode);
+                           OPTAB_WIDEN, &comparison, &cmpmode);
          if (comparison)
            {
              struct expand_operand ops[4];
index 4abcfb03f5afdbb3a138fe5ff68a83ca4bb2ea90..50274291efc3396e4287922baf2aa5e4de5d3018 100644 (file)
@@ -3,6 +3,9 @@
        Backported from mainline
        2018-03-15  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/84860
+       * gcc.c-torture/compile/pr84860.c: New test.
+
        PR c/84853
        * gcc.dg/pr84853.c: New test.
 
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr84860.c b/gcc/testsuite/gcc.c-torture/compile/pr84860.c
new file mode 100644 (file)
index 0000000..002737c
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR target/84860 */
+
+void
+foo (int x, int y)
+{
+  while (x < 1)
+    {
+      x = y;
+      y = ((float)1 / 0) ? 2 : 0;
+    }
+}