(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr104198.c
       1  /* Make sure if conversion for two instructions does not break
       2     anything (if it runs).  */
       3  
       4  /* { dg-do run } */
       5  /* { dg-options "-O2 -std=c99" } */
       6  
       7  #include <limits.h>
       8  #include <assert.h>
       9  
      10  __attribute__ ((noinline))
      11  int foo (int *a, int n)
      12  {
      13    int min = 999999;
      14    int bla = 0;
      15    for (int i = 0; i < n; i++)
      16      {
      17        if (a[i] < min)
      18  	{
      19  	  min = a[i];
      20  	  bla = 1;
      21  	}
      22      }
      23  
      24    if (bla)
      25      min += 1;
      26    return min;
      27  }
      28  
      29  int main()
      30  {
      31    int a[] = {2, 1, -13, INT_MAX, INT_MIN, 0};
      32  
      33    int res = foo (a, sizeof (a) / sizeof (a[0]));
      34  
      35    assert (res == (INT_MIN + 1));
      36  }