re PR sanitizer/80349 (UBSAN: compile time crash with "type mismatch in binary expression" message)
PR sanitizer/80349 * fold-const.c (fold_binary_loc) <case BIT_IOR_EXPR>: Convert arg0's first argument to type. * g++.dg/ubsan/pr80349-2.C: New test. From-SVN: r247260
This commit is contained in:
parent
6bcf239ec5
commit
8ef2085d4c
|
@ -1,3 +1,12 @@
|
|||
2017-04-25 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
2017-04-25 Marek Polacek <polacek@redhat.com>
|
||||
Backport from mainline
|
||||
|
||||
PR sanitizer/80349
|
||||
* fold-const.c (fold_binary_loc) <case BIT_IOR_EXPR>: Convert arg0's
|
||||
first argument to type.
|
||||
|
||||
2017-04-25 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
|
|
|
@ -9895,8 +9895,10 @@ fold_binary_loc (location_t loc,
|
|||
|
||||
/* If (C1|C2) == ~0 then (X&C1)|C2 becomes X|C2. */
|
||||
if (msk.and_not (c1 | c2) == 0)
|
||||
return fold_build2_loc (loc, BIT_IOR_EXPR, type,
|
||||
TREE_OPERAND (arg0, 0), arg1);
|
||||
{
|
||||
tem = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0));
|
||||
return fold_build2_loc (loc, BIT_IOR_EXPR, type, tem, arg1);
|
||||
}
|
||||
|
||||
/* Minimize the number of bits set in C1, i.e. C1 := C1 & ~C2,
|
||||
unless (C1 & ~C2) | (C2 & C3) for some C3 is a mask of some
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2017-04-25 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
2017-04-25 Marek Polacek <polacek@redhat.com>
|
||||
Backport from mainline
|
||||
|
||||
PR sanitizer/80349
|
||||
* g++.dg/ubsan/pr80349-2.C: New test.
|
||||
|
||||
2017-04-25 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// PR sanitizer/80349
|
||||
// { dg-do compile }
|
||||
// { dg-options "-fsanitize=undefined" }
|
||||
|
||||
unsigned long int ll;
|
||||
|
||||
int
|
||||
foo ()
|
||||
{
|
||||
return (2036854775807 >> ll & char(207648476159223) | 502810590243120797UL) << 0;
|
||||
}
|
Loading…
Reference in New Issue