===================================================================
@@ -5459,8 +5459,13 @@ eliminate_dom_walker::eliminate_stmt (ba
/* If this is an assignment from our leader (which
happens in the case the value-number is a constant)
- then there is nothing to do. */
- if (gimple_assign_single_p (stmt)
+ then there is nothing to do. Likewise if we run into
+ inserted code that needed a conversion because of
+ our type-agnostic value-numbering of loads. */
+ if ((gimple_assign_single_p (stmt)
+ || (is_gimple_assign (stmt)
+ && (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
+ || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)))
&& sprime == gimple_assign_rhs1 (stmt))
return;
===================================================================
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-Wno-div-by-zero" } */
+
+unsigned long int rr;
+
+void
+cw (int z9)
+{
+ int m5;
+ unsigned long int vz = 0;
+ long int *na;
+
+ if (z9 == 0)
+ rr = 0;
+ else
+ {
+ na = (long int *) &m5;
+ for (*na = 0; *na < 1; ++*na)
+ {
+ na = (long int *) &vz;
+ rr /= 0;
+ }
+ }
+
+ m5 = rr / 5;
+ ++vz;
+ if (vz != 0)
+ while (z9 < 1)
+ {
+ if (m5 >= 0)
+ rr += m5;
+
+ na = (long int *) &rr;
+ if (*na >= 0)
+ rr = 0;
+ }
+}