position_stack_vars sorts stack_vars_sorted in a manner that makes the order of stack vars with equal size undefined, thus making the compiler output host dependent.
Confirmed, this is a regression as partition_stack_vars is new in 4.0.x. I am thinking about either creating a meta-bug or a keyword about all the problems with unstable sorts/hashing with memory addresses problems.
A meta-bug would be helpful. I've marked this P2, since this bug doesn't actually result in a user-observable problem on a single host -- but it is extremely desirable from the point of view of us, as GCC developers, and from the point of view of many users, that all hosts generate the same code. So, it would be very good to get this defect fixed.
I have a patch.
Subject: Bug number PR28964 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00976.html
Subject: Bug 28964 Author: rguenth Date: Fri Sep 22 15:43:27 2006 New Revision: 117146 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117146 Log: 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. Modified: trunk/gcc/ChangeLog trunk/gcc/cfgexpand.c
Fixed on the mainline.
WONTFIX on 4.0/4.1 branches.