Bug 63953 - Binary incompatibility between versions 2.96 & 3.0 due to regparm calling convention
Binary incompatibility between versions 2.96 & 3.0 due to regparm calling con...
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-04-22 11:50 EDT by David L Kreitzer
Modified: 2007-04-18 12:42 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-04-22 11:54:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test case header file (150 bytes, text/plain)
2002-04-22 11:53 EDT, David L Kreitzer
no flags Details
Test case source file 1 (102 bytes, text/plain)
2002-04-22 11:54 EDT, David L Kreitzer
no flags Details
Test case source file 2 (147 bytes, text/plain)
2002-04-22 11:54 EDT, David L Kreitzer
no flags Details

  None (edit)
Description David L Kreitzer 2002-04-22 11:50:57 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Description of problem:
typedef struct
{
    struct {
        union {
            double d;
        } x;
    } x;
} S2;


__attribute__((regparm(3))) void f2(S2);

In gcc version 2.96, the parameter to f2 is passed on the stack.  In version 
3.0.3, the parameter is passed in 2 registers, eax and edx.

This can cause binaries compiled with 2.96 to not be interoperable with 
binaries compiled with 3.0.3.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.gcc -c try1.c      # Use gcc version 2.96
2.gcc try2.c try1.o  # Use gcc version 3.0.3
3.a.out

Note that the problem also happens if you compile try1.c with 3.0.3 and compile 
try2.c with 2.96.  Also, it's pretty easy to see this problem if you just 
produce the assembly files with the two compilers.


Actual Results:  a.out outputs the following:

s.x.x.d = -1.997456; it should be 5.0


Expected Results:  s.x.x.d = 5.000000; it should be 5.0


Additional info:
Comment 1 David L Kreitzer 2002-04-22 11:53:17 EDT
Created attachment 54847 [details]
Test case header file
Comment 2 David L Kreitzer 2002-04-22 11:54:11 EDT
Created attachment 54848 [details]
Test case source file 1
Comment 3 David L Kreitzer 2002-04-22 11:54:46 EDT
Created attachment 54850 [details]
Test case source file 2
Comment 4 Jakub Jelinek 2002-04-30 04:23:52 EDT
Don't do it then. Changing this would mean much bigger problem, gcc-2.96-RH
wouldn't be binary compatible with other 2.96-RH versions.

Note You need to log in before you can comment on or make changes to this bug.