summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-27 18:39:28 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-27 18:39:28 +0000
commite695b31d3268265b1cf1833303cede40347ca9f8 (patch)
tree1b85f7a0d257ecc9011ec995e7345b82efe83f45 /gcc/testsuite
parent53f9e3d0527049aabbf66901f55e091f7ddc0401 (diff)
downloadgcc-e695b31d3268265b1cf1833303cede40347ca9f8.tar.gz
PR c++/43555
* decl.c (grokdeclarator) [cdk_pointer et al]: Force evaluation of anonymous VLA size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159939 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/vla9.C38
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 63e32a39510..5501c8dd93e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/43555
+ * g++.dg/ext/vla9.C: New.
+
2010-05-27 Iain Sandoe <iains@gcc.gnu.org>
PR ObjC/44140
diff --git a/gcc/testsuite/g++.dg/ext/vla9.C b/gcc/testsuite/g++.dg/ext/vla9.C
new file mode 100644
index 00000000000..c58edbc9bd1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vla9.C
@@ -0,0 +1,38 @@
+// PR c++/43555
+// { dg-options "" }
+// { dg-do run }
+
+extern "C" void * malloc (__SIZE_TYPE__);
+extern "C" int printf (const char *, ...);
+extern "C" void abort(void);
+
+int nx,ny;
+
+void f(double *x1d,int choice)
+{
+ double (*x2d)[nx][ny]=(double(*)[nx][ny])x1d;
+ unsigned long delta;
+// (*x2d)[0][0]=123; // <- this line affects the result
+ if (choice!=0)
+ {
+ delta=&(*x2d)[1][0]-x1d;
+ }
+ else
+ {
+ delta=&(*x2d)[1][0]-x1d;
+ }
+ printf("Choice: %d, Delta: %ld\n",choice,delta);
+ if (delta != ny)
+ abort ();
+}
+
+int main()
+{
+ double *data;
+ nx=100;
+ ny=100;
+ data=(double*)malloc(nx*ny*sizeof(double));
+ f(data,0);
+ f(data,1);
+ return 0;
+}