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

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
So, we don't optimize at -O2

long foo (int a)
{
  return (long)(a + 1) - 1;
}

Note that (T)(A +- CST1) +- CST2 -> (T)A +- CST3 thus the combined
addition in general needs to be done in the larger type _unless_ the
absolute constant value of CST3 is equal or smaller than CST1.

Handling the special case of CST1 == CST2 might be easiest here.

Reply via email to