[PATCH] Fix small structure passing on x86-64

Eric Botcazou ebotcazou@adacore.com
Fri Oct 31 11:50:00 GMT 2008


Hi,

the structure

struct S { char c; char arr[4]; float f; };

is incorrect passed on x86-64/Linux with every C compiler I tried: only the 
first 4 bytes and the float are passed (in registers), the 5th byte is lost.
That's because the first word has partial integer class X86_64_INTEGERSI_CLASS 
instead of full integer class X86_64_INTEGER_CLASS.

Tested on x86_64-suse-linux and compat-regtested against the system compiler, 
OK for mainline?


2008-10-31  Eric Botcazou  <ebotcazou@adacore.com>

	* config/i386/i386.c (classify_argument) <ARRAY_TYPE>: Promote partial
	integer class to full integer class if the offset is not word-aligned.


2008-10-31  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.c-torture/execute/20081031.c: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 638 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081031/b1187755/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c
Type: text/x-csrc
Size: 262 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081031/b1187755/attachment-0001.bin>


More information about the Gcc-patches mailing list