(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
ifc-pr44710.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-c -O2 -ftree-vectorize" { target *-*-* } } */
       3  
       4  #include <stdio.h>
       5  #include <stdlib.h>
       6  
       7  #define N 64
       8  float arr[N];
       9  
      10  __attribute__ ((noinline)) 
      11  int foo (unsigned int n, float *min)
      12  {
      13    unsigned int pos = 1;
      14    unsigned int i;
      15    float limit = N+N;
      16  
      17    for (i = 0; i < N; i++)
      18      if (arr[i] < limit)
      19        {
      20          pos = i + 1;
      21          limit = arr[i];
      22        }
      23  
      24    *min = limit;
      25    return pos;
      26  }
      27  
      28  int main (void)
      29  {
      30    int i, pos;
      31    float min;
      32  
      33    for (i = 0; i < N; i++)
      34     arr[i] = (float)(i);
      35  
      36    arr[2] = -5.8;
      37  
      38    pos = foo (N, &min);
      39    if (pos != 3 || min != arr[2])
      40      abort ();
      41  
      42    return 0;
      43  }
      44