1  /* { dg-do run } */
       2  /* { dg-options "-fsanitize=signed-integer-overflow" } */
       3  
       4  __attribute__((noinline, noclone)) int
       5  foo1 (int x, int y)
       6  {
       7    return x - y;
       8  }
       9  
      10  __attribute__((noinline, noclone)) int
      11  foo2 (int x, int y)
      12  {
      13    unsigned int xa = (unsigned int) x - (__INT_MAX__ - 3);
      14    xa &= 3;
      15    x = __INT_MAX__ - 3 + xa;
      16    unsigned int ya = y + 1U;
      17    ya &= 1;
      18    y = ya - 1;
      19    return x - y;
      20  }
      21  
      22  int
      23  main ()
      24  {
      25    int xm1, y;
      26    for (xm1 = __INT_MAX__ - 4; xm1 < __INT_MAX__; xm1++)
      27      for (y = -1; y <= 0; y++)
      28        if (foo1 (xm1 + 1, y) != (int) (xm1 + 1U - y)
      29  	  || foo2 (xm1 + 1, y) != (int) (xm1 + 1U - y))
      30  	__builtin_abort ();
      31    return 0;
      32  }
      33  /* { dg-output ":7:\[0-9]\[^\n\r]*signed integer overflow: 2147483647 - -1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
      34  /* { dg-output "\[^\n\r]*:19:\[0-9]\[^\n\r]*signed integer overflow: 2147483647 - -1 cannot be represented in type 'int'" } */