Commit 2ef42cf9 by Marek Polacek Committed by Marek Polacek

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: r247257
parent 70caf430
2017-04-25 Marek Polacek <polacek@redhat.com>
PR sanitizer/80349
* fold-const.c (fold_binary_loc) <case BIT_IOR_EXPR>: Convert arg0's
first argument to type.
2017-04-25 Bill Seurer <seurer@linux.vnet.ibm.com>
PR target/80482
......
......@@ -9898,8 +9898,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
......
2017-04-25 Marek Polacek <polacek@redhat.com>
PR sanitizer/80349
* g++.dg/ubsan/pr80349-2.C: New test.
2017-04-25 Volker Reichelt <v.reichelt@netcologne.de>
* g++.dg/cpp0x/enum34.C: New test.
......
// PR sanitizer/80349
// { dg-do compile }
// { dg-options "-fsanitize=undefined" }
unsigned long int ll;
int
foo ()
{
return (2036854775807 >> ll & char(207648476159223) | 502810590243120797UL) << 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment