@@ -0,0 +1,30 @@
+/* PR middle-end/71408 */
+/* { dg-do run } */
+/* { dg-options "-Os" } */
+unsigned a, b;
+
+struct S0
+{
+ int f1:18;
+ unsigned f3:4;
+};
+
+void fn1 ()
+{
+ struct S0 c = { 7, 0 };
+ if (c.f1)
+ c.f3 = 3;
+ a = -~c.f3;
+ c.f3 = ~(c.f1 && c.f1);
+ c.f1 = c.f3 * (c.f1 - (c.f1 - a % c.f1)) + ~c.f3 * -a;
+ b = ~(c.f1 & a);
+ if (b >= 4294967295)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ fn1 ();
+ return 0;
+}
@@ -1203,7 +1203,8 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op)
{
if (gimple_assign_rhs1 (stmt) == op)
{
- propagate_op_to_single_use (op, stmt, def);
+ tree cst = build_minus_one_cst (TREE_TYPE (op));
+ propagate_op_to_single_use (cst, stmt, def);
return;
}
else if (integer_minus_onep (op)
@@ -1251,7 +1252,8 @@ zero_one_operation (tree *def, enum tree_code opcode, tree op)
{
if (gimple_assign_rhs1 (stmt2) == op)
{
- propagate_op_to_single_use (op, stmt2, def);
+ tree cst = build_minus_one_cst (TREE_TYPE (op));
+ propagate_op_to_single_use (cst, stmt2, def);
return;
}
else if (integer_minus_onep (op)