This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/19566] x86_64 - inconsistent choice of parameter passing method for 16 byte struct
- From: "gary at intrepid dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2005 21:34:13 -0000
- Subject: [Bug target/19566] x86_64 - inconsistent choice of parameter passing method for 16 byte struct
- References: <20050121160542.19566.gary@intrepid.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gary at intrepid dot com 2005-01-30 21:34 -------
>From a C point of view, the types are incompatible. But, from an ABI point of
view, shouldn't values of both types be passed in the same way (ie, copied into
registers rather than being copied to the stack in one case, and registers in
the other)?
This problem arose when generating code for an experimental dialect of C,
called UPC, where certain 'shared pointer' values are passed as a structure
which includes a (phase, thread, address) triple, and phase is 48 bits, thread
is 16 bits, and the address part of the value is 64 bits. The compiler
(internally) chose a 'short' representation of thread, where the separately
compiled runtime declared the thread field as an 'int'. (Clearly, there is a
simple workaround, which is to declare the types identically.)
However, if we look at the differently declared types from an ABI point of
view, they have the same internal rep. in terms of size and alignment, and I
think that the ABI would say that values of both types should be passed in
registers. Certainly, the code inside 'classify_argument()' shouldn't view
the 'short' field as being unaligned, which in turn causes the value of (64
bit) words to be 2 rather 1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19566