aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-10-06 09:15:48 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-10-06 09:15:48 +0200
commit86a0f64291720469505a83812911c07ab7a2453f (patch)
tree11b6eca46692102cbf386e7bf44a3dd3eff1125a /gcc
parent0d3abf6f9e44a3341754463170ff12d504e77530 (diff)
downloadgcc-86a0f64291720469505a83812911c07ab7a2453f.zip
gcc-86a0f64291720469505a83812911c07ab7a2453f.tar.gz
gcc-86a0f64291720469505a83812911c07ab7a2453f.tar.bz2
re PR c/29091 (vector constant not fully outputed)
PR c/29091 * varasm.c (output_constant): If TREE_VECTOR_CST_ELTS chain is shorter than the number of vector elements fill the rest with zeros. * gcc.dg/pr29091.c: New test. From-SVN: r117481
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr29091.c44
-rw-r--r--gcc/varasm.c6
4 files changed, 60 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3ae2d25..3eaecfe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/29091
+ * varasm.c (output_constant): If TREE_VECTOR_CST_ELTS chain is shorter than
+ the number of vector elements fill the rest with zeros.
+
2006-10-05 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips.c (mips_pass_by_reference): Do not return false
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 31ba8d4..7fb74e7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-10-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/29091
+ * gcc.dg/pr29091.c: New test.
+
2006-10-06 Joseph Myers <joseph@codesourcery.com>
* lib/target-supports.exp
diff --git a/gcc/testsuite/gcc.dg/pr29091.c b/gcc/testsuite/gcc.dg/pr29091.c
new file mode 100644
index 0000000..6e06c63
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr29091.c
@@ -0,0 +1,44 @@
+/* PR c/29091 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+__attribute__ ((vector_size (sizeof (int) * 4))) int a = { 1, 2 };
+int d = 3;
+__attribute__ ((vector_size (sizeof (int) * 4))) int b = { 4, 5, 6 };
+int e = 7;
+__attribute__ ((vector_size (sizeof (int) * 4))) int c = { };
+
+int
+main (void)
+{
+ int *p = (int *) &a;
+ if (p[0] != 1)
+ abort ();
+ if (p[1] != 2)
+ abort ();
+ if (p[2] != 0)
+ abort ();
+ if (p[3] != 0)
+ abort ();
+ p = (int *) &b;
+ if (p[0] != 4)
+ abort ();
+ if (p[1] != 5)
+ abort ();
+ if (p[2] != 6)
+ abort ();
+ if (p[3] != 0)
+ abort ();
+ p = (int *) &c;
+ if (p[0] != 0)
+ abort ();
+ if (p[1] != 0)
+ abort ();
+ if (p[2] != 0)
+ abort ();
+ if (p[3] != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index ff3e443..d14dc70 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4403,8 +4403,12 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
link = TREE_VECTOR_CST_ELTS (exp);
output_constant (TREE_VALUE (link), elt_size, align);
+ thissize = elt_size;
while ((link = TREE_CHAIN (link)) != NULL)
- output_constant (TREE_VALUE (link), elt_size, nalign);
+ {
+ output_constant (TREE_VALUE (link), elt_size, nalign);
+ thissize += elt_size;
+ }
break;
}
default: