1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-all" } */
       3  
       4  #include <stdlib.h>
       5  #define N 32
       6  float *foo(int ustride, int size, float *src)
       7  {
       8     float *buffer, *p;
       9     int i, k;
      10  
      11     if (!src)
      12      return NULL;
      13  
      14     buffer = (float *) malloc(N * size * sizeof(float));
      15  
      16     if(buffer)
      17        for(i=0, p=buffer; i<N; i++, src+=ustride)
      18  	for(k=0; k<size; k++)
      19  	  *p++ = src[k];
      20  
      21     return buffer;
      22  }
      23  
      24  /* { dg-final { scan-tree-dump-times "Guard hoisted" 1 "unswitch" } } */