Bug 63953 - Binary incompatibility between versions 2.96 & 3.0 due to regparm calling convention
Summary: Binary incompatibility between versions 2.96 & 3.0 due to regparm calling con...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-04-22 15:50 UTC by David L Kreitzer
Modified: 2007-04-18 16:42 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-04-22 15:54:50 UTC
Embargoed:


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

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.


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