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
+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
&& 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)
+2018-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/88426
+ * c-c++-common/ubsan/float-cast-overflow-11.c: New test.
+
2018-12-11 Yannick Moy <moy@adacore.com>
* gnat.dg/ghost4.adb: New testcase.
--- /dev/null
+/* PR sanitizer/88426 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=float-cast-overflow" } */
+
+int
+foo (void)
+{
+ const float v = 0.0f;
+ return (int) (v < 0.0f ? v : 0.0f);
+}