Vector support has been seriously damaged in Ada since the re-implementation of the VECTOR_CST node. This fixes crashes.
Tested on i586-suse-linux, applied on the mainline as obvious. 2012-03-28 Eric Botcazou <ebotca...@adacore.com> * tree.c (tree_size) <VECTOR_CST>: New case. 2012-03-28 Eric Botcazou <ebotca...@adacore.com> * gnat.dg/vect7.ad[sb]: New test. -- Eric Botcazou
Index: tree.c =================================================================== --- tree.c (revision 185857) +++ tree.c (working copy) @@ -724,6 +724,10 @@ tree_size (const_tree node) return (sizeof (struct tree_vec) + (TREE_VEC_LENGTH (node) - 1) * sizeof (tree)); + case VECTOR_CST: + return (sizeof (struct tree_vector) + + (TYPE_VECTOR_SUBPARTS (TREE_TYPE (node)) - 1) * sizeof (tree)); + case STRING_CST: return TREE_STRING_LENGTH (node) + offsetof (struct tree_string, str) + 1;
-- { dg-do compile } package body Vect7 is procedure Assign is v1 : constant v4sf := (-1.0, -2.0, -3.0, -4.0); v2 : v4sf := v1; v3 : v4sf; begin v3 := vzero; v3 := vconst; v3 := v1; v3 := v2; v3 := (1.0, -2.0, 3.0, -4.0); v3 := (1.0, -2.0, 3.0, F); v2 := vzero; end; end Vect7;
package Vect7 is type v4sf is array (1 .. 4) of Float; for v4sf'Alignment use 16; pragma Machine_Attribute (v4sf, "vector_type"); vzero : constant v4sf := (0.0, 0.0, 0.0, 0.0); vconst : constant v4sf := (1.0, 2.0, 3.0, 4.0); vvar : v4sf := vconst; F : Float := 5.0; procedure Assign; end Vect7;