Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / ext / vla9.C
blobc58edbc9bd1bc1c026488b4918099d2059fb2728
1 // PR c++/43555
2 // { dg-options "" }
3 // { dg-do run }
5 extern "C" void * malloc (__SIZE_TYPE__);
6 extern "C" int printf (const char *, ...);
7 extern "C" void abort(void);
9 int nx,ny;
11 void f(double *x1d,int choice)
13   double (*x2d)[nx][ny]=(double(*)[nx][ny])x1d;
14   unsigned long delta;
15 //  (*x2d)[0][0]=123; // <- this line affects the result
16   if (choice!=0)
17   {
18     delta=&(*x2d)[1][0]-x1d;
19   }
20   else
21   {
22     delta=&(*x2d)[1][0]-x1d;
23   }
24   printf("Choice: %d, Delta: %ld\n",choice,delta);
25   if (delta != ny)
26     abort ();
29 int main()
31   double *data;
32   nx=100;
33   ny=100;
34   data=(double*)malloc(nx*ny*sizeof(double));
35   f(data,0);
36   f(data,1);
37   return 0;