aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-12-11 14:51:44 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-12-11 14:51:44 +0100
commit6d9391732bc8816627ff40103a6261d233c722bf (patch)
treeb926476141d3410ddc5c98ecd3f60c03a32b092a /gcc/c
parentef9fc3ba34633a5efc1a123557ecda1691731466 (diff)
downloadgcc-6d9391732bc8816627ff40103a6261d233c722bf.zip
gcc-6d9391732bc8816627ff40103a6261d233c722bf.tar.gz
gcc-6d9391732bc8816627ff40103a6261d233c722bf.tar.bz2
re PR sanitizer/88426 (Compiler crash if use special code with command line switch -fsanitize=float-cast-overflow)
PR sanitizer/88426 * c-convert.c (convert): Call c_fully_fold before calling ubsan_instrument_float_cast. * c-c++-common/ubsan/float-cast-overflow-11.c: New test. From-SVN: r267022
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-convert.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 9bbfe76..294442c 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/88426
+ * c-convert.c (convert): Call c_fully_fold before calling
+ ubsan_instrument_float_cast.
+
2018-12-08 Segher Boessenkool <segher@kernel.crashing.org>
* c-parser (c_parser_asm_statement) [RID_INLINE]: Delete stray line
diff --git a/gcc/c/c-convert.c b/gcc/c/c-convert.c
index b57bb8e..6165e14 100644
--- a/gcc/c/c-convert.c
+++ b/gcc/c/c-convert.c
@@ -115,6 +115,7 @@ convert (tree type, tree expr)
&& COMPLETE_TYPE_P (type))
{
expr = save_expr (expr);
+ expr = c_fully_fold (expr, false, NULL);
tree check = ubsan_instrument_float_cast (loc, type, expr);
expr = fold_build1 (FIX_TRUNC_EXPR, type, expr);
if (check == NULL_TREE)