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

            Bug ID: 120477
           Summary: arith_overflow_check_p has a special case for
                    COND_EXPR but it is dead
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: internal-improvement
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

arith_overflow_check_p does the following for COND_EXPR gimple assignment:
```
      else if (gimple_assign_rhs_code (cur_use_stmt) == COND_EXPR)
        {
          tree cond = gimple_assign_rhs1 (cur_use_stmt);
          if (COMPARISON_CLASS_P (cond))
            {
              ccode = TREE_CODE (cond);
              crhs1 = TREE_OPERAND (cond, 0);
              crhs2 = TREE_OPERAND (cond, 1);
            }
          else
            return 0;
        }
```

But cond here will always be a SSA_NAME (or a constant) so we always get a
return 0.

Which case should be ok, and the code is just dead as we would have processed
the comparison already.

Reply via email to