Bug 43869 - ms_abi -> sysv_abi passing float arguments incorrectly
Summary: ms_abi -> sysv_abi passing float arguments incorrectly
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-23 18:38 UTC by Maarten Lankhorst
Modified: 2010-05-24 12:29 UTC (History)
5 users (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-04-28 23:14:02


Attachments
testcase (283 bytes, text/plain)
2010-04-23 18:38 UTC, Maarten Lankhorst
Details
Patch that fixes the testcase (629 bytes, patch)
2010-04-25 14:41 UTC, Maarten Lankhorst
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Lankhorst 2010-04-23 18:38:05 UTC
Float arguments are passed incorrectly from a ms_abi function to a sysv function, as can be witnessed by a simple testcase, which fails on all optimizations. I don't think this is a regression, as wine always failed on that testcase.
Comment 1 Maarten Lankhorst 2010-04-23 18:38:46 UTC
Created attachment 20474 [details]
testcase

testcase that fails
Comment 2 Andrew Pinski 2010-04-23 18:40:56 UTC
This works with:
GNU C (GCC) version 4.6.0 20100422 (experimental) [trunk revision 158652] (x86_64-unknown-linux-gnu)
Comment 3 Andrew Pinski 2010-04-23 18:44:46 UTC
(In reply to comment #2)
> This works with:
> GNU C (GCC) version 4.6.0 20100422 (experimental) [trunk revision 158652]
> (x86_64-unknown-linux-gnu)
> 

I take that back, it still fails, for some reason I thought the testcase was using abort to test for a failure rather than the return value.
Comment 4 Maarten Lankhorst 2010-04-25 14:41:07 UTC
Created attachment 20483 [details]
Patch that fixes the testcase

It appears that SSE_REGPARM_MAX will change based on ix86_cfun_abi(), so using SSE_REGPARM_MAX will cause sse regparm max to be 4, if calling a sysv function from a ms_abi function. The attached patch will clean up some of the issues.

setup_incoming_varargs_64 will also assume the sysv abi now, since setup_incoming_varargs_ms_64 is a separate function
Comment 5 Kai Tietz 2010-05-23 06:52:12 UTC
Subject: Bug 43869

Author: ktietz
Date: Sun May 23 06:51:50 2010
New Revision: 159754

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159754
Log:
2010-05-23  Naarten Lankhorst  <mlankhorst@codeweavers.com>

        PR target/43869
        * gcc.c-target/pr43869.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr43869.c   (with props)
Modified:
    trunk/gcc/testsuite/ChangeLog

Propchange: trunk/gcc/testsuite/gcc.target/i386/pr43869.c
            ('svn:eol-style' added)

Propchange: trunk/gcc/testsuite/gcc.target/i386/pr43869.c
            ('svn:mime-type' added)


Comment 6 Kai Tietz 2010-05-23 06:52:49 UTC
Subject: Bug 43869

Author: ktietz
Date: Sun May 23 06:52:32 2010
New Revision: 159755

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159755
Log:
2010-05-23  Naarten Lankhorst  <mlankhorst@codeweavers.com>

        PR target/43869
        * config/i386/i386.c: Make sure that the correct regparm is passed.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c

Comment 7 Kai Tietz 2010-05-23 06:57:33 UTC
Subject: Bug 43869

Author: ktietz
Date: Sun May 23 06:57:20 2010
New Revision: 159756

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159756
Log:
2010-05-23  Naarten Lankhorst  <mlankhorst@codeweavers.com>

	Merged from trunk
        PR target/43869
        * config/i386/i386.c: Make sure that the correct regparm is passed.

2010-05-23  Naarten Lankhorst  <mlankhorst@codeweavers.com>

	Merged from trunk
        PR target/43869
        * gcc.c-target/pr43869.c: New test.



Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr43869.c   (with props)
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/config/i386/i386.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Propchange: branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr43869.c
            ('svn:eol-style' added)

Propchange: branches/gcc-4_5-branch/gcc/testsuite/gcc.target/i386/pr43869.c
            ('svn:mime-type' added)


Comment 8 Kai Tietz 2010-05-23 07:12:42 UTC
Fixed on trunk and back-merged to gcc-4_5 branch.