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
This commit is contained in:
Jakub Jelinek 2006-10-06 09:15:48 +02:00 committed by Jakub Jelinek
parent 0d3abf6f9e
commit 86a0f64291
4 changed files with 60 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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);
thissize += elt_size;
}
break;
}
default: