diff options
| author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-12 15:53:15 +0000 |
|---|---|---|
| committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-12 15:53:15 +0000 |
| commit | e67bda386ddfbe740ecbb7c336f76360a393386b (patch) | |
| tree | 946fe0ac7035b526d4c0e4b559d4af285731875d | |
| parent | b89d59056f65962610b41f5bfb38abc59875370c (diff) | |
| download | ppe42-gcc-e67bda386ddfbe740ecbb7c336f76360a393386b.tar.gz ppe42-gcc-e67bda386ddfbe740ecbb7c336f76360a393386b.zip | |
PR middle-end/45962
* cfgexpand.c (add_stack_var): Ensure every variable has 1 byte.
(expand_stack_vars): Assert large base allocated when used.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165382 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cfgexpand.c | 23 |
2 files changed, 22 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ce3832a99e..7f4a478e780 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-12 Richard Henderson <rth@redhat.com> + + PR middle-end/45962 + * cfgexpand.c (add_stack_var): Ensure every variable has 1 byte. + (expand_stack_vars): Assert large base allocated when used. + 2010-10-12 Richard Guenther <rguenther@suse.de> * tree-ssa-structalias.c (get_constraint_for_1): Constants diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index de686b5004d..1ef1fa0d8f2 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -253,6 +253,8 @@ alloc_stack_frame_space (HOST_WIDE_INT size, unsigned HOST_WIDE_INT align) static void add_stack_var (tree decl) { + struct stack_var *v; + if (stack_vars_num >= stack_vars_alloc) { if (stack_vars_alloc) @@ -262,17 +264,23 @@ add_stack_var (tree decl) stack_vars = XRESIZEVEC (struct stack_var, stack_vars, stack_vars_alloc); } - stack_vars[stack_vars_num].decl = decl; - stack_vars[stack_vars_num].offset = 0; - stack_vars[stack_vars_num].size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (decl)), 1); - stack_vars[stack_vars_num].alignb = get_decl_align_unit (SSAVAR (decl)); + v = &stack_vars[stack_vars_num]; + + v->decl = decl; + v->offset = 0; + v->size = tree_low_cst (DECL_SIZE_UNIT (SSAVAR (decl)), 1); + /* Ensure that all variables have size, so that &a != &b for any two + variables that are simultaneously live. */ + if (v->size == 0) + v->size = 1; + v->alignb = get_decl_align_unit (SSAVAR (decl)); /* All variables are initially in their own partition. */ - stack_vars[stack_vars_num].representative = stack_vars_num; - stack_vars[stack_vars_num].next = EOC; + v->representative = stack_vars_num; + v->next = EOC; /* All variables initially conflict with no other. */ - stack_vars[stack_vars_num].conflicts = NULL; + v->conflicts = NULL; /* Ensure that this decl doesn't get put onto the list twice. */ set_rtl (decl, pc_rtx); @@ -839,6 +847,7 @@ expand_stack_vars (bool (*pred) (tree)) /* Large alignment is only processed in the last pass. */ if (pred) continue; + gcc_assert (large_base != NULL); large_alloc += alignb - 1; large_alloc &= -(HOST_WIDE_INT)alignb; |

