https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119222

--- Comment #9 from Gwen Fu <gwen3293940943 at gmail dot com> ---
I am sorry for my recklessness and carelessness! And thank you for your patient
guidance.

In gcc/convert.cc : func:convert_to_integer_1 :
the case :
    case REAL_TYPE:
      if (sanitize_flags_p (SANITIZE_FLOAT_CAST)
          && current_function_decl != NULL_TREE)
        {
          expr = save_expr (expr);
          tree check = ubsan_instrument_float_cast (loc, type, expr);
          expr = build1 (FIX_TRUNC_EXPR, type, expr);
          if (check == NULL_TREE)
            return expr;
          return maybe_fold_build2_loc (dofold, loc, COMPOUND_EXPR,
                                        TREE_TYPE (expr), check, expr);
        }
      else
        return build1 (FIX_TRUNC_EXPR, type, expr);

this case is about processing floating point numbers.

But when I use gdb to figure out  the run process of this case
gdb --args ../objdir/gcc/cc1plus -Wall -Wextra 119222.cc

However,The program is executed "return build1 (FIX_TRUNC_EXPR, type, expr);
"directly . 
Breakpoint 2, convert_to_integer_1 (type=0x7ffff78285e8, expr=0x7ffff79bba28,
dofold=false) at ../../gcc/gcc/convert.cc:934
934           if (sanitize_flags_p (SANITIZE_FLOAT_CAST)
(gdb) s
sanitize_flags_p (flag=flag@entry=65536, fn=0x7ffff79c1b00) at
../../gcc/gcc/asan.h:248
248       if (result_flags == 0)
(gdb) s
convert_to_integer_1 (type=0x7ffff78285e8, expr=0x7ffff79bba28, dofold=false)
at ../../gcc/gcc/convert.cc:946


This indicates that the sanitization for detecting floating point conversions
is not enabled.

Reply via email to