Red Hat Bugzilla – Bug 63953
Binary incompatibility between versions 2.96 & 3.0 due to regparm calling convention
Last modified: 2007-04-18 12:42:16 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Description of problem:
__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):
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
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
Created attachment 54847 [details]
Test case header file
Created attachment 54848 [details]
Test case source file 1
Created attachment 54850 [details]
Test case source file 2
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.