(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
pr99954.c
       1  /* { dg-do run } */
       2  
       3  #include <assert.h>
       4  
       5  #define CONTAINER_KIND union
       6  
       7  typedef CONTAINER_KIND container { int value; } container;
       8  
       9  void move(container* end, container* start) {
      10      container* p;
      11      for (p = end; p > start; p--) {
      12  	(p)->value = (p-1)->value;
      13      }
      14  }
      15  
      16  #define N 100
      17  
      18  int main(int argc, char* argv[]) {
      19      container vals[N];
      20      int i;
      21      for (i=0; i<N; i++) {
      22          vals[i].value = argc + i;
      23      }
      24      move(&vals[N-1], &vals[0]);
      25      assert(vals[0].value == argc + 0);
      26      for (i=1; i<N; i++) {
      27          assert(vals[i].value == argc + i - 1);
      28      }
      29      return 0;
      30  }