[Bug tree-optimization/114203] [13/14 Regression] Miscompilation: A possible miscompilation in GCC 13 and 14 with option -Os

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 4 09:36:40 GMT 2024


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
  (set_nb_iterations_in_loop = b_3(D) != 0 ? (unsigned int) (32 - __builtin_clz
((unsigned int) b_3(D))) : 24))

The issue is for prec <= i_prec we do

     call = build_call_expr (fn, 1, src);
      if (define_at_zero)
        {
          tree is_zero = fold_build2 (NE_EXPR, boolean_type_node, src,
                                      build_zero_cst (TREE_TYPE (src)));
          call = fold_build3 (COND_EXPR, integer_type_node, is_zero, call,
                              build_int_cst (integer_type_node, prec));
        }

      if (leading && prec < i_prec)
        call = fold_build2 (MINUS_EXPR, integer_type_node, call,
                            build_int_cst (integer_type_node, i_prec - prec));

but that's the wrong way around, 'define_at_zero' should happen after the
adjustment for leading.


More information about the Gcc-bugs mailing list