re PR middle-end/81705 (UBSAN: yet another false positive)
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. * c-c++-common/ubsan/pr81705.c: New testcase. From-SVN: r250866
This commit is contained in:
parent
54cb4e2006
commit
165b2f5f5d
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
@ -9592,12 +9592,13 @@ fold_binary_loc (location_t loc,
|
||||
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)
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
12
gcc/testsuite/c-c++-common/ubsan/pr81705.c
Normal file
12
gcc/testsuite/c-c++-common/ubsan/pr81705.c
Normal file
@ -0,0 +1,12 @@
|
||||
/* { 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user