+2017-08-04 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81705
+ * fold-const.c (fold_binary_loc): Properly restrict
+ minus_var0 && minus_var1 case when associating undefined overflow
+ entities.
+
2017-08-04 Tom de Vries <tom@codesourcery.com>
* omp-simd-clone.c (simd_clone_adjust): Add missing edge probability.
if (POINTER_TYPE_P (atype)
|| (INTEGRAL_TYPE_P (atype) && !TYPE_OVERFLOW_WRAPS (atype)))
{
- if (var0 && var1)
+ if ((var0 && var1) || (minus_var0 && minus_var1))
{
/* ??? If split_tree would handle NEGATE_EXPR we could
- simplify this down to the var0/minus_var1 cases. */
- tree tmp0 = var0;
- tree tmp1 = var1;
+ simply reject these cases and the allowed cases would
+ be the var0/minus_var1 ones. */
+ tree tmp0 = var0 ? var0 : minus_var0;
+ tree tmp1 = var1 ? var1 : minus_var1;
bool one_neg = false;
if (TREE_CODE (tmp0) == NEGATE_EXPR)
+2017-08-04 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/81705
+ * c-c++-common/ubsan/pr81705.c: New testcase.
+
2017-08-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gcc.target/powerpc/bfp/scalar-cmp-exp-eq-2.c: Adjust for error
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined -fsanitize-undefined-trap-on-error" } */
+
+int var_4 = -1716607962;
+int var_14 = 943738830;
+volatile int a;
+int main()
+{
+ // (-(-1716607962) - 516151698) - -(9403738830)
+ a = (-var_4 - 516151698) - -var_14;
+ return 0;
+}