diff options
author | Marek Polacek <polacek@redhat.com> | 2016-01-06 10:24:15 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-01-06 10:24:15 +0000 |
commit | 6b131d5b1e7ac7d2c75f71505cd935c3dac28a4b (patch) | |
tree | fed93df58aa881dc5fef68cb7b3ecaffb7b22bd7 /gcc/ubsan.c | |
parent | 396a2ee2ecfc2deb2f6672c9149be22ce244d242 (diff) | |
download | gcc-6b131d5b1e7ac7d2c75f71505cd935c3dac28a4b.zip gcc-6b131d5b1e7ac7d2c75f71505cd935c3dac28a4b.tar.gz gcc-6b131d5b1e7ac7d2c75f71505cd935c3dac28a4b.tar.bz2 |
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
Diffstat (limited to 'gcc/ubsan.c')
-rw-r--r-- | gcc/ubsan.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/ubsan.c b/gcc/ubsan.c index e5b49b2..d3fbfd1 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -1478,18 +1478,18 @@ ubsan_use_new_style_p (location_t loc) } /* Instrument float point-to-integer conversion. TYPE is an integer type of - destination, EXPR is floating-point expression. ARG is what to pass - the libubsan call as value, often EXPR itself. */ + destination, EXPR is floating-point expression. */ tree -ubsan_instrument_float_cast (location_t loc, tree type, tree expr, tree arg) +ubsan_instrument_float_cast (location_t loc, tree type, tree expr) { tree expr_type = TREE_TYPE (expr); tree t, tt, fn, min, max; machine_mode mode = TYPE_MODE (expr_type); int prec = TYPE_PRECISION (type); bool uns_p = TYPE_UNSIGNED (type); - if (!loc) loc = input_location; + if (loc == UNKNOWN_LOCATION) + loc = input_location; /* Float to integer conversion first truncates toward zero, so even signed char c = 127.875f; is not problematic. @@ -1609,7 +1609,7 @@ ubsan_instrument_float_cast (location_t loc, tree type, tree expr, tree arg) fn = builtin_decl_explicit (bcode); fn = build_call_expr_loc (loc, fn, 2, build_fold_addr_expr_loc (loc, data), - ubsan_encode_value (arg, false)); + ubsan_encode_value (expr, false)); } return fold_build3 (COND_EXPR, void_type_node, t, fn, integer_zero_node); |