From 6b131d5b1e7ac7d2c75f71505cd935c3dac28a4b Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 6 Jan 2016 10:24:15 +0000 Subject: re PR sanitizer/69099 (ICE when compiling gcc.dg/atomic/c11-atomic-exec-2.c with -fsanitize=float-cast-overflow) PR sanitizer/69099 * c-convert.c (convert) [INTEGER_TYPE]: Drop ARG. Don't pass ARG to ubsan_instrument_float_cast. Fold EXPR. Use NULL_TREE instead of NULL. * convert.c (convert_to_integer_1): Adjust call to ubsan_instrument_float_cast. Use NULL_TREE instead of NULL. * ubsan.c (ubsan_instrument_float_cast): Drop the ARG parameter. Use EXPR instead of ARG. * ubsan.h (ubsan_instrument_float_cast): Adjust declaration. * gcc.dg/ubsan/float-cast-overflow-atomic.c: New test. From-SVN: r232099 --- gcc/c/c-convert.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'gcc/c/c-convert.c') diff --git a/gcc/c/c-convert.c b/gcc/c/c-convert.c index 5ee52eb..4167c34 100644 --- a/gcc/c/c-convert.c +++ b/gcc/c/c-convert.c @@ -111,20 +111,16 @@ convert (tree type, tree expr) && COMPLETE_TYPE_P (type) && do_ubsan_in_current_function ()) { - tree arg; if (in_late_binary_op) - { - expr = save_expr (expr); - arg = expr; - } + expr = save_expr (expr); else { expr = c_save_expr (expr); - arg = c_fully_fold (expr, false, NULL); + expr = c_fully_fold (expr, false, NULL); } - tree check = ubsan_instrument_float_cast (loc, type, expr, arg); + tree check = ubsan_instrument_float_cast (loc, type, expr); expr = fold_build1 (FIX_TRUNC_EXPR, type, expr); - if (check == NULL) + if (check == NULL_TREE) return expr; return fold_build2 (COMPOUND_EXPR, TREE_TYPE (expr), check, expr); } -- cgit v1.1