(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr57459.c
       1  /* PR rtl-optimization/57459 */
       2  /* { dg-do run } */
       3  /* { dg-options "-fno-inline -O2 -minline-all-stringops -fno-omit-frame-pointer" } */
       4  
       5  int total1[10], total2[10], total3[10], total4[10], total5[10], a[20];
       6  int len;
       7  
       8  void stackclean() {
       9    void *ptr = __builtin_alloca(20000);
      10    __builtin_memset(ptr, 0, 20000);
      11  }
      12  
      13  void foo(const char *s) {
      14    int r1 = a[1];
      15    int r2 = a[2];
      16    int r3 = a[3];
      17    int r4 = a[4];
      18    int r5 = a[5];
      19  
      20    len =  __builtin_strlen(s);
      21  
      22    if (s != 0)
      23      return;
      24  
      25    while (r1) {
      26     total1[r1] = r1;
      27     r1--;
      28    }
      29  
      30    while (r2) {
      31     total2[r2] = r2;
      32     r2--;
      33    }
      34  
      35    while (r3) {
      36     total3[r3] = r3;
      37     r3--;
      38    }
      39  
      40    while (r4) {
      41     total4[r4] = r4;
      42     r4--;
      43    }
      44  
      45    while (r5) {
      46     total5[r5] = r5;
      47     r5--;
      48    }
      49  }
      50  
      51  extern void abort (void);
      52  
      53  int main() {
      54    stackclean();
      55    foo("abcdefgh");
      56    if (len != 8)
      57      abort ();
      58    return 0;
      59  }
      60