mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-23 00:41:25 +08:00
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
This commit is contained in:
parent
ef9fc3ba34
commit
6d9391732b
@ -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
|
||||
|
@ -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)
|
||||
|
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
10
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-11.c
Normal file
10
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-11.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* 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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user