Hello,

Coverity flagged a real issue in this patch:

On Mon, 16 Jan 2023, Jan Hubicka via Gcc-patches wrote:
> --- a/gcc/ipa-utils.cc
> +++ b/gcc/ipa-utils.cc
[...]
> +bitmap
> +find_always_executed_bbs (function *fun, bool assume_return_or_eh)
> +{
> +  auto_vec<basic_block, 20> stack;
> +  auto_vec<basic_block, 20> terminating_bbs;
> +  hash_set<basic_block> visited;
> +  edge e;
> +  edge_iterator ei;
> +
> +  /* First walk all BBs reachable from entry stopping on statements that may
> +     terminate execution.  Everything past this statement is not going to be 
> executed
> +     each invocation.  */
> +  stack.safe_push (ENTRY_BLOCK_PTR_FOR_FN (fun));
> +  while (!stack.is_empty ())
> +    {
> +      basic_block bb = stack.pop ();
> +      bool found = false, found_exit = false;
> +      if (!assume_return_or_eh
> +       && (EDGE_COUNT (bb->succs) == 0 || (bb->flags & BB_IRREDUCIBLE_LOOP)))
> +     found = true;
> +      FOR_EACH_EDGE (e, ei, bb->succs)
> +     {
> +       if (e->dest == EXIT_BLOCK_PTR_FOR_FN (fun))
> +         {
> +           found_exit = true;
> +           break;
> +         }
> +       /* Watch for infinite loops.  */
> +       if (!found && (assume_return_or_eh & EDGE_DFS_BACK)
                                             ^^^^^^^^^^^^^^^
This bitwise 'and' always evaluates to zero, making the entire clause 
always-false.

Alexander

Reply via email to