This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12122] gcc do not respect stack argument list order
- From: "zack at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Sep 2003 06:01:19 -0000
- Subject: [Bug c/12122] gcc do not respect stack argument list order
- References: <20030901053735.12122.bland@mail.ru>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12122
------- Additional Comments From zack at gcc dot gnu dot org 2003-09-01 06:01 -------
To clarify what Andrew has said:
In the abstract, there is absolutely no guarantee anywhere that arguments are
passed in any particular order, nor that they are necessarily all in memory. For
any given platform, the ABI does specify where the arguments will be found, and
in what order. However, that only controls what the call setup sequence and
function prologue look like. The compiler is completely free to rearrange
things afterward. Your program's output is not defined either by the C standard
or any platform ABI.
To give a concrete example, on a sparc all four of the arguments to fn1 will be
passed in registers. Since you took their addresses, GCC must copy them from
the registers to temporary locations on the stack. It is free to organize those
locations any way it likes.