diff options
author | Richard Guenther <rguenther@suse.de> | 2006-09-22 15:43:27 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-09-22 15:43:27 +0000 |
commit | 79f802f532f0c531de64e388bb70fe909e0f21d0 (patch) | |
tree | 3dc7f167f845bdbf2553d933ab80e6fffce43b25 | |
parent | 459f9f82ec0fe88bf83a5fbee366c6063a461c2b (diff) | |
download | gcc-79f802f532f0c531de64e388bb70fe909e0f21d0.zip gcc-79f802f532f0c531de64e388bb70fe909e0f21d0.tar.gz gcc-79f802f532f0c531de64e388bb70fe909e0f21d0.tar.bz2 |
re PR middle-end/28964 (partition_stack_vars uses unstable sort)
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.
From-SVN: r117146
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cfgexpand.c | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 190d387..87c39b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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. + 2006-09-22 Peter Bergner <bergner@vnet.ibm.com> PR middle-end/28690 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 9839d09..4cc1047 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; } |