aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2009-04-22 23:22:53 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2009-04-22 16:22:53 -0700
commit53650abeb3960ae5e097833fdee977c4074f5f97 (patch)
tree8a2b08aad5f448475045b459fab1de28915eed36 /gcc/testsuite
parent912bb79567a3b7bf3824b4e4a97278233bae337a (diff)
downloadgcc-53650abeb3960ae5e097833fdee977c4074f5f97.zip
gcc-53650abeb3960ae5e097833fdee977c4074f5f97.tar.gz
gcc-53650abeb3960ae5e097833fdee977c4074f5f97.tar.bz2
re PR c/31499 (rejects vector int a[] = {1,1,1,1,1};)
2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C/31499 * c-typeck.c (process_init_element): Treat VECTOR_TYPE like ARRAY_TYPE and RECORD_TYPE/UNION_TYPE. When outputing the actual element and the value is a VECTOR_CST, the element type is the element type of the vector. 2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C/31499 * gcc.dg/vector-init-1.c: New testcase. * gcc.dg/vector-init-2.c: New testcase. From-SVN: r146628
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/vector-init-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/vector-init-2.c25
3 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8002f79..8869fc1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR C/31499
+ * gcc.dg/vector-init-1.c: New testcase.
+ * gcc.dg/vector-init-2.c: New testcase.
+
2009-04-22 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/enum2.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/vector-init-1.c b/gcc/testsuite/gcc.dg/vector-init-1.c
new file mode 100644
index 0000000..5baf956
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vector-init-1.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+
+/* PR C/31499, test that the C front-end treats vectors like an array. */
+
+#define vector __attribute__((__vector_size__(4*sizeof(int)) ))
+vector signed int v1[]={0,1,2,3,4,5,6,7};
diff --git a/gcc/testsuite/gcc.dg/vector-init-2.c b/gcc/testsuite/gcc.dg/vector-init-2.c
new file mode 100644
index 0000000..6527f49
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vector-init-2.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+/* PR C/31499, test that the C front-end treats vectors like an array
+ and that it works at runtime. */
+
+#define vector __attribute__((__vector_size__(4*sizeof(int)) ))
+vector signed int v1[]={0,1,2,3,4,5,6,7};
+
+
+int main(void)
+{
+ int i;
+ for (i = 0; i < sizeof(v1)/sizeof(v1[0]); i++)
+ {
+ vector int t = v1[i];
+ int *d = (int*)&t;
+ int j;
+ for (j = 0; j < 4; j++)
+ {
+ if (d[j] != i * 4 + j)
+ __builtin_abort ();
+ }
+ }
+ return 0;
+} \ No newline at end of file