summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-22 15:43:27 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-22 15:43:27 +0000
commit7615883aaa47ab3268a344a708b7f61c1affe86a (patch)
tree3dc7f167f845bdbf2553d933ab80e6fffce43b25 /gcc/cfgexpand.c
parent3ec3503f17126d41760ae9734bcef6b743e623f6 (diff)
downloadgcc-7615883aaa47ab3268a344a708b7f61c1affe86a.tar.gz
2006-09-22 Richard Guenther <rguenther@suse.de>
PR middle-end/28964 * cfgexpand.c (stack_var_size_cmp): Use DECL_UID to make sort of stack variables stable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117146 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 9839d098375..4cc1047fadf 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -350,11 +350,19 @@ stack_var_size_cmp (const void *a, const void *b)
{
HOST_WIDE_INT sa = stack_vars[*(const size_t *)a].size;
HOST_WIDE_INT sb = stack_vars[*(const size_t *)b].size;
+ unsigned int uida = DECL_UID (stack_vars[*(const size_t *)a].decl);
+ unsigned int uidb = DECL_UID (stack_vars[*(const size_t *)b].decl);
if (sa < sb)
return -1;
if (sa > sb)
return 1;
+ /* For stack variables of the same size use the uid of the decl
+ to make the sort stable. */
+ if (uida < uidb)
+ return -1;
+ if (uida > uidb)
+ return 1;
return 0;
}