summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-05 21:46:31 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-05 21:46:31 +0000
commit823a9dd48593c13a959d2bcf2635b48a36509626 (patch)
tree0fb2cd367e6916c7cd83f6635fec9facebcc58a5 /gcc/convert.c
parentd8a5b68899bb4013ddc0e62e73dbc97aedef0067 (diff)
downloadgcc-823a9dd48593c13a959d2bcf2635b48a36509626.tar.gz
PR sanitizer/64344
* ubsan.h (ubsan_instrument_float_cast): Add ARG argument. * ubsan.c (ubsan_instrument_float_cast): Add ARG argument, pass it to libubsan handler instead of EXPR. Fold comparisons earlier, if the result is integer_zerop, return NULL_TREE. * convert.c (convert_to_integer): Pass expr as ARG. c/ * c-typeck.c (convert_for_assignment, c_finish_return): For -fsanitize=float-cast-overflow casts from REAL_TYPE to integer/enum types also set in_late_binary_op around convert call. * c-convert.c (convert): For -fsanitize=float-cast-overflow REAL_TYPE to integral type casts, if not in_late_binary_op, pass c_fully_fold result on expr as last argument to ubsan_instrument_float_cast, if in_late_binary_op, don't use c_save_expr but save_expr. testsuite/ * c-c++-common/ubsan/pr64344-1.c: New test. * c-c++-common/ubsan/pr64344-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index c65d013f19d..0491986bd1e 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -890,7 +890,7 @@ convert_to_integer (tree type, tree expr)
DECL_ATTRIBUTES (current_function_decl)))
{
expr = save_expr (expr);
- tree check = ubsan_instrument_float_cast (loc, type, expr);
+ tree check = ubsan_instrument_float_cast (loc, type, expr, expr);
expr = build1 (FIX_TRUNC_EXPR, type, expr);
if (check == NULL)
return expr;