re PR target/84860 (ICE in emit_move_insn, at expr.c:3717)
authorJakub Jelinek <jakub@redhat.com>
Thu, 15 Mar 2018 08:35:28 +0000 (09:35 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 15 Mar 2018 08:35:28 +0000 (09:35 +0100)
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: r258552

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

index b4dde6ea8b449627e5451f2c4c2f3cc34715ead4..07999ed4662c33c1837c23a078a35f365ef0427b 100644 (file)
@@ -1,3 +1,9 @@
+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-15  Julia Koval  <julia.koval@intel.com>
 
        * config/i386/i386.c (F_AVX512VBMI2, F_GFNI, F_VPCLMULQDQ,
index 5f61e4e9521b58b9cdb7f8207d69fa8e042feecf..53a147c8ef6b524629144bfceaef8253c3d1409b 100644 (file)
@@ -4345,9 +4345,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 4962ff5f4078ea65db573bfe2ad9af69aae88f39..994b8ee7fddd71b13501e3cd202109324a58af36 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84860
+       * gcc.c-torture/compile/pr84860.c: New test.
+
 2018-03-15  Julia Koval  <julia.koval@intel.com>
 
        * gcc.target/i386/builtin_target.c (check_intel_cpu_model): Add
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;
+    }
+}