Commit 6d939173 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/88426 (Compiler crash if use special code with command line…

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
parent ef9fc3ba
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> 2018-12-08 Segher Boessenkool <segher@kernel.crashing.org>
* c-parser (c_parser_asm_statement) [RID_INLINE]: Delete stray line * c-parser (c_parser_asm_statement) [RID_INLINE]: Delete stray line
......
...@@ -115,6 +115,7 @@ convert (tree type, tree expr) ...@@ -115,6 +115,7 @@ convert (tree type, tree expr)
&& COMPLETE_TYPE_P (type)) && COMPLETE_TYPE_P (type))
{ {
expr = save_expr (expr); expr = save_expr (expr);
expr = c_fully_fold (expr, false, NULL);
tree check = ubsan_instrument_float_cast (loc, type, expr); tree check = ubsan_instrument_float_cast (loc, type, expr);
expr = fold_build1 (FIX_TRUNC_EXPR, type, expr); expr = fold_build1 (FIX_TRUNC_EXPR, type, expr);
if (check == NULL_TREE) 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> 2018-12-11 Yannick Moy <moy@adacore.com>
* gnat.dg/ghost4.adb: New testcase. * gnat.dg/ghost4.adb: New testcase.
......
/* 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment