Bug 63953

Summary: Binary incompatibility between versions 2.96 & 3.0 due to regparm calling convention
Product: [Retired] Red Hat Linux Reporter: David L Kreitzer <david.l.kreitzer>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-04-22 15:54:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test case header file
none
Test case source file 1
none
Test case source file 2 none

Description David L Kreitzer 2002-04-22 15:50:57 UTC
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 15:53:17 UTC
Created attachment 54847 [details]
Test case header file

Comment 2 David L Kreitzer 2002-04-22 15:54:11 UTC
Created attachment 54848 [details]
Test case source file 1

Comment 3 David L Kreitzer 2002-04-22 15:54:46 UTC
Created attachment 54850 [details]
Test case source file 2

Comment 4 Jakub Jelinek 2002-04-30 08:23:52 UTC
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.