mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-10-04 16:08:34 +00:00
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
This commit is contained in:
committed by
Jakub Jelinek
parent
c8b622ff2d
commit
40182dbff7
@@ -1,5 +1,12 @@
|
||||
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,
|
||||
|
||||
+6
-3
@@ -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;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user