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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gcc head does not comply    |[12 Regression] gcc head
                   |fully to -fwrapv            |does not comply fully to
                   |                            |-fwrapv since r12-1723
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com,
                   |                            |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-06-29
          Component|c                           |tree-optimization
   Target Milestone|---                         |12.0
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r12-1723-gae6b830f31a47aca7ca24c4fea245c29214eef3a
Adjusted testcase for testsuite:
/* PR tree-optimization/101254 */
/* { dg-do run } */
/* { dg-options "-O2 -fwrapv" } */

int
foo (long long imin, long long imax)
{
  if (imin > imax)
    return 0;
  else if (imax - imin < 0 || (imax - imin) + 1 < 0)
    return 0;
  return 1;
}

int
main ()
{
  long long imax = __LONG_LONG_MAX__;
  long long imin = -imax - 1; 
  if (!foo (-10, 10))
    __builtin_abort ();
  if (foo (-10, imax))
    __builtin_abort ();
  if (foo (imin, imax))
    __builtin_abort ();
  return 0;
}

Reply via email to