diff options
author | Richard Guenther <rguenther@suse.de> | 2012-04-16 13:21:30 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-04-16 13:21:30 +0000 |
commit | ac9a074c7249d0a042b827696caa3f694befaee5 (patch) | |
tree | 067d3bace4ca7e9ad5771e700d5b82b337858715 /gcc/tree.c | |
parent | fba621209f542447474d7e1b5d33ba21df14f04d (diff) | |
download | gcc-ac9a074c7249d0a042b827696caa3f694befaee5.zip gcc-ac9a074c7249d0a042b827696caa3f694befaee5.tar.gz gcc-ac9a074c7249d0a042b827696caa3f694befaee5.tar.bz2 |
re PR c/52977 (internal compiler error: Segmentation fault with `-x c-header' or `-x cxx-header' option)
2012-04-16 Richard Guenther <rguenther@suse.de>
PR middle-end/52977
* tree.h (VECTOR_CST_NELTS): Adjust.
(struct tree_vector): Add explicit length field.
(make_vector_stat): Declare.
(make_vector): Define.
* tree.c (make_vector_stat): New function.
(build_vector_stat): Use it.
* tree-streamer-in.c (streamer_alloc_tree): Likewise.
From-SVN: r186494
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -1315,6 +1315,25 @@ cst_and_fits_in_hwi (const_tree x) || TREE_INT_CST_HIGH (x) == -1); } +/* Build a newly constructed TREE_VEC node of length LEN. */ + +tree +make_vector_stat (unsigned len MEM_STAT_DECL) +{ + tree t; + unsigned length = (len - 1) * sizeof (tree) + sizeof (struct tree_vector); + + record_node_allocation_statistics (VECTOR_CST, length); + + t = ggc_alloc_zone_cleared_tree_node_stat (&tree_zone, length PASS_MEM_STAT); + + TREE_SET_CODE (t, VECTOR_CST); + TREE_CONSTANT (t) = 1; + VECTOR_CST_NELTS (t) = len; + + return t; +} + /* Return a new VECTOR_CST node whose type is TYPE and whose values are in a list pointed to by VALS. */ @@ -1323,16 +1342,7 @@ build_vector_stat (tree type, tree *vals MEM_STAT_DECL) { int over = 0; unsigned cnt = 0; - tree v; - int length = ((TYPE_VECTOR_SUBPARTS (type) - 1) * sizeof (tree) - + sizeof (struct tree_vector)); - - record_node_allocation_statistics (VECTOR_CST, length); - - v = ggc_alloc_zone_cleared_tree_node_stat (&tree_zone, length PASS_MEM_STAT); - - TREE_SET_CODE (v, VECTOR_CST); - TREE_CONSTANT (v) = 1; + tree v = make_vector (TYPE_VECTOR_SUBPARTS (type)); TREE_TYPE (v) = type; /* Iterate through elements and check for overflow. */ |