Commit 09956017 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/80403 (UBSAN: compile time crash with "type mismatch in binary…

re PR sanitizer/80403 (UBSAN: compile time crash with "type mismatch in binary expression" message in / and % expr)

	PR sanitizer/80403
	* fold-const.c (fold_ternary_loc): Revert
	use op0 instead of fold_convert_loc (loc, type, arg0) part of
	2017-04-12 change.

	* g++.dg/ubsan/pr80403-2.C: New test.

From-SVN: r246917
parent bc042396
2017-04-13 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/80403
* fold-const.c (fold_ternary_loc): Revert
use op0 instead of fold_convert_loc (loc, type, arg0) part of
2017-04-12 change.
2017-04-13 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/80343
......
......@@ -11544,7 +11544,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
&& (code == VEC_COND_EXPR || !VECTOR_TYPE_P (type)))
return fold_build2_loc (loc, code == VEC_COND_EXPR ? BIT_AND_EXPR
: TRUTH_ANDIF_EXPR,
type, op0, op1);
type, fold_convert_loc (loc, type, arg0), 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)
......
2017-04-13 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/80403
* g++.dg/ubsan/pr80403-2.C: New test.
2017-04-13 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/80343
......
// PR sanitizer/80403
// { dg-do compile }
// { dg-options "-fsanitize=undefined" }
extern const long long int v;
extern unsigned long int w;
int
foo ()
{
int a = (0 - 40U <= (0 == 8)) << !w << (0 < v) == 0;
int b = ((0 ^ 0) < (long) (1066066618772207110 <= 0)) / 0 << 0; // { dg-warning "division by zero" }
return a + b;
}
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