[Bug tree-optimization/102513] [10/11/12 Regression] Many false positive warnings with recursive function

fxue at os dot amperecomputing.com gcc-bugzilla@gcc.gnu.org
Sun Feb 6 00:37:53 GMT 2022


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

Feng Xue <fxue at os dot amperecomputing.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxue at os dot amperecomputing.com

--- Comment #7 from Feng Xue <fxue at os dot amperecomputing.com> ---
(In reply to Jakub Jelinek from comment #6)
> It is in
>       /* Recursively generate lattice values with a limited count.  */
>       FOR_EACH_VEC_ELT (val_seeds, i, src_val)
>         {
>           for (int j = 1; j < max_recursive_depth; j++)
>             {
>               tree cstval = get_val_across_arith_op (opcode, opnd1_type,
> opnd2,
>                                                      src_val, res_type);
>               if (!cstval
>                   || !ipacp_value_safe_for_type (res_type, cstval))
>                 break;
> 
>               ret |= dest_lat->add_value (cstval, cs, src_val, src_idx,
>                                           src_offset, &src_val, j);
>               gcc_checking_assert (src_val);
>             }
>         }
> (but there is another spot doing the similar thing) where it would be nice
> to also break if cstval is non-NULL and safe for type, but is outside of the
> value range.  I have no idea how to get from this spot at that value range
> though.

By default, ipcp is told to clone a recursive function 8 times, that exceeds
value space of index in this case. We could rely on ipa fnsummary on condition
predicate of a call to avoid generating never-executed copy. I will take it.


More information about the Gcc-bugs mailing list