Commit 40182dbf by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/21897 (Segementation fault in fold_ternary)

	* fold-const.c (operand_equal_p): Don't return 1, if element
	chains for 2 VECTOR_CSTs are not the same length.

	PR regression/21897
	* fold-const.c (fold_ternary) <case BIT_FIELD_REF>: Don't crash if
	not all VECTOR_CST elements are given.

	* gcc.c-torture/execute/20050604-1.c: New test.

From-SVN: r100674
parent c8b622ff
2005-06-06 Jakub Jelinek <jakub@redhat.com>
* fold-const.c (operand_equal_p): Don't return 1, if element
chains for 2 VECTOR_CSTs are not the same length.
PR regression/21897
* fold-const.c (fold_ternary) <case BIT_FIELD_REF>: Don't crash if
not all VECTOR_CST elements are given.
* combine.c (try_combine): Use hard_regno_nregs array instead of
HARD_REGNO_NREGS macro.
* config/rs6000/rs6000.c (rs6000_split_multireg_move,
......
......@@ -2460,7 +2460,7 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
v2 = TREE_CHAIN (v2);
}
return 1;
return v1 == v2;
}
case COMPLEX_CST:
......@@ -10306,9 +10306,12 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
< TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)))
{
tree elements = TREE_VECTOR_CST_ELTS (arg0);
while (idx-- > 0)
while (idx-- > 0 && elements)
elements = TREE_CHAIN (elements);
return TREE_VALUE (elements);
if (elements)
return TREE_VALUE (elements);
else
return fold_convert (type, integer_zero_node);
}
}
return NULL_TREE;
......
2005-06-06 Jakub Jelinek <jakub@redhat.com>
PR regression/21897
* gcc.c-torture/execute/20050604-1.c: New test.
2005-06-06 Nathan Sidwell <nathan@codesourcery.com>
PR 21903
......
/* PR regression/21897 */
extern void abort (void);
typedef short v4hi __attribute__ ((vector_size (8)));
typedef float v4sf __attribute__ ((vector_size (16)));
union
{
v4hi v;
short s[4];
} u;
union
{
v4sf v;
float f[4];
} v;
void
foo (void)
{
unsigned int i;
for (i = 0; i < 2; i++)
u.v += (v4hi) { 12, 14 };
for (i = 0; i < 2; i++)
v.v += (v4sf) { 18.0, 20.0, 22 };
}
int
main (void)
{
foo ();
if (u.s[0] != 24 || u.s[1] != 28 || u.s[2] || u.s[3])
abort ();
if (v.f[0] != 36.0 || v.f[1] != 40.0 || v.f[2] != 44.0 || v.f[3] != 0.0)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment