(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vla-stexp-8.c
       1  /* PR29970, PR91038 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -Wunused-variable" } */
       4  
       5  
       6  int foo0(void)
       7  {
       8  	int c = *(*(*({ int n = 10; int (*x)[n][n] = __builtin_malloc(sizeof *x); x; }) + 5) + 5);
       9  	return c;
      10  }
      11  
      12  int foo1(void)
      13  {
      14  	int c = *(5 + *(5 + *({ int n = 10; int (*x)[n][n] = __builtin_malloc(sizeof *x); x; })));
      15  	return c;
      16  }
      17  
      18  int bar2(void)
      19  {
      20  	int c = (*({ int n = 10; struct { int y[n]; int z; }* x = __builtin_malloc(sizeof *x); x; })).z;
      21  	return c;
      22  }
      23  
      24  int bar3(void)
      25  {
      26  	int n = 2;	/* { dg-warning "unused variable" } */
      27  	int c = (*({ int n = 3; 	/* { dg-warning "unused variable" } */
      28  		({ int n = 10; int (*x)[n][n] = __builtin_malloc(sizeof *x); x; }); }))[5][5];
      29  	return c;
      30  }
      31  
      32  int bar3b(void)
      33  {
      34  	int n = 2;	/* { dg-warning "unused variable" } */
      35  	int c = (*({ int n = 3; 	/* { dg-warning "unused variable" } */
      36  		({ int n = 10; int (*x)[n][n] = __builtin_malloc(sizeof *x); x; }); }))[0][0];
      37  	return c;
      38  }
      39  
      40  int bar4(void)
      41  {
      42  	int n = 2;	/* { dg-warning "unused variable" } */
      43  	int c = *(5 + *( 5 + *({ int n = 3;	/* { dg-warning "unused variable" } */
      44  		({ int n = 10; int (*x)[n][n] = __builtin_malloc(sizeof *x); x; }); })));
      45  	return c;
      46  }
      47