This is the mail archive of the gcc-patches@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]

Re: PATCH: PR target/39678: complex type isn't passed correctly


On Thu, Apr 9, 2009 at 10:16 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> H.J. Lu wrote:
>
>> When SCmode starts at 32bit in a structure, we need to pass it in
>> one X86_64_SSE_CLASS and one X86_64_SSESF_CLASS. ?OK for trunk and
>> 4.4 if there are no regressions?
>>
>> Thanks.
>>
>>
>> H.J.
>> ----
>> gcc/
>>
>> 2009-04-09 ?H.J. Lu ?<hongjiu.lu@intel.com>
>>
>> ? ? ? ?PR target/39678
>> ? ? ? ?* config/i386/i386.c (classify_argument): Handle SCmode with
>> ? ? ? ?(bit_offset % 64) != 0.
>>
>
> comments below...
>
>> gcc/testsuite/
>>
>> 2009-04-09 ?H.J. Lu ?<hongjiu.lu@intel.com>
>>
>> ? ? ? ?PR target/39678
>> ? ? ? ?* g++.dg/torture/pr39678.C: New.
>> ? ? ? ?* gcc.dg/torture/pr39678.c: Likewise.
>> ? ? ? ?* gcc.target/i386/pr39678.c: Likewise.
>>
>> ? ? ? ?* gcc.target/x86_64/abi/test_passing_structs.c: Add tests for
>> ? ? ? ?structure with complex float.
>>
>> --- gcc/config/i386/i386.c.complex ? ? ?2009-04-09 05:45:01.000000000
>> -0700
>> +++ gcc/config/i386/i386.c ? ? ?2009-04-09 07:02:07.000000000 -0700
>> @@ -5273,7 +5273,22 @@ classify_argument (enum machine_mode mod
>> ? ? ? return 2;
>> ? ? case SCmode:
>> ? ? ? classes[0] = X86_64_SSE_CLASS;
>> - ? ? ?return 1;
>> + ? ? ?if (!(bit_offset % 64))
>> + ? ? ? return 1;
>> + ? ? ?else
>> + ? ? ? {
>> + ? ? ? ? static bool warned;
>> +
>> + ? ? ? ? if (!warned && warn_psabi)
>> + ? ? ? ? ? {
>> + ? ? ? ? ? ? warned = true;
>> + ? ? ? ? ? ? inform (input_location,
>> + ? ? ? ? ? ? ? ? ? ? "The ABI of passing structure with complex float"
>> + ? ? ? ? ? ? ? ? ? ? " member has changed in GCC 4.4");
>>
>
> This message should end with "... in GCC 4.4.1".

This ABI bug leads to run time error, not just compatibility with
other compiler.
I will leave 4.4 ASIS for mainline and update it when it is backported
to 4.4 branch.

> The patch is OK with this change for 4.5 and after a day or two without
> problems also for 4.4.
>

Here is the updated patch to properly initialize complex numbers.
I also added -Wno-psabi to gcc.dg/compat/struct-complex-1
and added a new one, gcc.dg/compat/struct-complex-2.

I will check it if there are no regressions.

Thanks.

-- 
H.J.
---
gcc/

2009-04-09  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/39678
	* config/i386/i386.c (classify_argument): Handle SCmode with
	(bit_offset % 64) != 0.

gcc/testsuite/

2009-04-09  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/39678
	* g++.dg/torture/pr39678.C: New.
	* gcc.dg/compat/struct-complex-2.h: Likewise.
	* gcc.dg/compat/struct-complex-2_main.c: Likewise.
	* gcc.dg/compat/struct-complex-2_x.c: Likewise.
	* gcc.dg/compat/struct-complex-2_y.c: Likewise.
	* gcc.dg/torture/pr39678.c: Likewise.
	* gcc.target/i386/pr39678.c: Likewise.

	* gcc.dg/compat/struct-complex-1_x.c: Add -Wno-psabi.
	* gcc.dg/compat/struct-complex-1_y.c: Likewise.

	* gcc.target/x86_64/abi/test_passing_structs.c: Include
	<complex.h>.  Add tests for structure with complex float.

Attachment: gcc-pr39678-2.patch
Description: Text document


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