+2017-04-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/80403
+ PR sanitizer/80404
+ PR sanitizer/80405
+ * fold-const.c (fold_ternary_loc): Use op1 instead of arg1 as argument
+ to fold_build2_loc. Convert TREE_OPERAND (tem, 0) to type. Use
+ op0 instead of fold_convert_loc (loc, type, arg0).
+
2017-04-12 Jeff Law <law@redhat.com>
* genattrtab.c (write_eligible_delay): Verify DELAY_INSN still
STRIP_NOPS (tem);
if (TREE_CODE (tem) == RSHIFT_EXPR
&& tree_fits_uhwi_p (TREE_OPERAND (tem, 1))
- && (unsigned HOST_WIDE_INT) tree_log2 (arg1) ==
- tree_to_uhwi (TREE_OPERAND (tem, 1)))
+ && (unsigned HOST_WIDE_INT) tree_log2 (arg1)
+ == tree_to_uhwi (TREE_OPERAND (tem, 1)))
return fold_build2_loc (loc, BIT_AND_EXPR, type,
- TREE_OPERAND (tem, 0), arg1);
+ fold_convert_loc (loc, type,
+ TREE_OPERAND (tem, 0)),
+ op1);
}
/* A & N ? N : 0 is simply A & N if N is a power of two. This
&& (code == VEC_COND_EXPR || !VECTOR_TYPE_P (type)))
return fold_build2_loc (loc, code == VEC_COND_EXPR ? BIT_AND_EXPR
: TRUTH_ANDIF_EXPR,
- type, fold_convert_loc (loc, type, arg0), arg1);
+ type, op0, op1);
/* Convert A ? B : 1 into !A || B if A and B are truth values. */
if (code == VEC_COND_EXPR ? integer_all_onesp (op2) : integer_onep (op2)
? BIT_IOR_EXPR
: TRUTH_ORIF_EXPR,
type, fold_convert_loc (loc, type, tem),
- arg1);
+ op1);
}
/* Convert A ? 0 : B into !A && B if A and B are truth values. */
2017-04-12 Jakub Jelinek <jakub@redhat.com>
+ PR sanitizer/80403
+ PR sanitizer/80404
+ PR sanitizer/80405
+ * g++.dg/ubsan/pr80403.C: New test.
+ * g++.dg/ubsan/pr80404.C: New test.
+ * g++.dg/ubsan/pr80405.C: New test.
+
PR c/80163
* gcc.dg/torture/pr80163.c: New test.