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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

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

--- Comment #6 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Looks like because it thinks that

    f = f - e;
    if (c - 9 * f) {
      __builtin_abort();

is always true, but misses the obvious case that when c == 0 and e ==
2147483647 c will be 0 and stay 0.

This happens because after propagating the initial value of f into the
expression

    f = 2147483647 - e;
    if (c - 9 * f) {
      __builtin_abort();

The following IV candidate is generated

Candidate 7:
  Depend on inv.exprs: 2
  Var befor: ivtmp.12
  Var after: ivtmp.12
  Incr POS: before exit test
  IV struct:
    Type:       unsigned int
    Base:       (unsigned int) e_8(D) * 9 + (unsigned int) c.0_5
    Step:       (unsigned int) (e_8(D) * 9)
    Biv:        N
    Overflowness wrto loop niter:       Overflow

instead of

Candidate 6:
  Depend on inv.exprs: 2
  Var befor: ivtmp.11
  Var after: ivtmp.11
  Incr POS: before exit test
  IV struct:
    Type:       unsigned int
    Base:       (unsigned int) ((2147483647 - e_8(D)) * -9 + c.0_5)
    Step:       (unsigned int) (e_8(D) * 9)
    Biv:        N
    Overflowness wrto loop niter:       Overflow

which now makes it that the base expression can't be 0 because it's known that
e_8 is 5 or 2147483647.

So mine.

Reply via email to