Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 352201 (PR43869)

Summary: [4.4] ms_abi -> sysv_abi passing float arguments incorrectly (app-emulation/wine[win64])
Product: Gentoo Linux Reporter: Israel G. Lugo <israel.lugo>
Component: [OLD] Core systemAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: bug, wyvern5
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://gcc.gnu.org/PR43869
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Test case showing the problem
Patch to fix the problem
gcc-4.4.5-msabi.patch

Description Israel G. Lugo 2011-01-20 05:01:12 UTC
The current stable GCC (4.4.4-r2) suffers from the following bug:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43869
(ms_abi -> sysv_abi passing float arguments incorrectly)

Quoting the original description by Maarten Lankhorst:
> 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.

This bug will break wine 64-bits (app-emulation/wine with win64 use flag enabled), as per the wine website (http://wiki.winehq.org/Wine64):
> GCC 4.4 is affected by the gcc64 float bug, so compiling with it will
> result in some broken code. GCC 4.5.1 should compile Wine correctly.

The problem was fixed by upstream on their development trunk and back-ported to the GCC 4.5 branch, but 4.4 is still affected. Since GCC 4.4 is the stable branch on Gentoo, that means wine will be affected as well (and possibly other programs using the ms_abi).

I will attach the testcase created by Maarten Lankhorst, as well as his patch that solves the problem. I have confirmed that stable gcc-4.4.4-r2 does fail the testcase on my system (amd64), with or without optimization.
Comment 1 Israel G. Lugo 2011-01-20 05:04:17 UTC
Created attachment 260330 [details]
Test case showing the problem

$ gcc -o testcase testcase.c
$ ./testcase
$ echo $?
16
$ gcc --version
gcc (Gentoo 4.4.4-r2 p1.2, pie-0.4.5) 4.4.4
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The test case should return 0 for success.
Comment 2 Israel G. Lugo 2011-01-20 05:11:21 UTC
Created attachment 260331 [details, diff]
Patch to fix the problem

Patch made against upstream GCC trunk, revision 158676. Committed by upstream in revision 159755 with the following message:

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.

Merged by upstream to 4.5 branch in revision 159756.
Comment 3 Israel G. Lugo 2011-01-20 05:17:22 UTC
Forgot to mention... My proposal was for this to be backported into a new gcc-4.4.4-r3 or so, to replace the current stable version of gcc-4.4.4-r2. We shouldn't have stable GCC breaking other stable ebuilds.
Comment 4 wyvern5 2011-03-04 18:50:44 UTC
Any progress on this? It'd be nice to be able to build wine.
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2011-03-04 20:43:04 UTC
This patch needs to be ported first.
Comment 6 Ryan Hill (RETIRED) gentoo-dev 2011-03-04 21:13:06 UTC
Created attachment 264753 [details, diff]
gcc-4.4.5-msabi.patch
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2011-07-03 03:18:27 UTC
Released in 4.4.5 p1.3.