This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/19566] x86_64 - inconsistent choice of parameter passing method for 16 byte struct


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]