Bug 54480 - GCC Parameter Passing problem on ia64
GCC Parameter Passing problem on ia64
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
ia64 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-10-09 15:21 EDT by John Kacur
Modified: 2007-04-18 12:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-11-19 12:46:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Kacur 2001-10-09 15:21:09 EDT
Description of Problem:
The problem has to deal with parameter passing. According to IA64 calling conventions, we should pass the first 8 words of 
the arguments through registers, and the rest can go into the stack. Here is a typical example:

arg0 -> out0 (reg)
arg1 -> out1 (reg)
arg2 -> out2 (reg)
arg3 -> out3 (reg)
arg4 -> out4 (reg)
arg5 -> out5 (reg)
arg6 -> out6 (reg)
arg7 -> out7 (reg)
arg8 -> 16(sp)
arg9 -> 24(sp)
arg10 -> 32(sp)
arg11 -> 40(sp)

The bug that I found occur if the 8th & 9th arguments are structures (with two words in my case). The following happens:

arg0 -> out0 (reg)
arg1 -> out1 (reg)
arg2 -> out2 (reg)
arg3 -> out3 (reg)
arg4 -> out4 (reg)
arg5 -> out5 (reg)
arg6 -> out6 (reg)
arg7 (word0) -> out7 (reg) 
arg7 (word1) -> 16(sp) 
??? ->  24(sp)
arg8 (word0) -> 32(sp)
arg8 (word1) -> 40(sp)
arg9 -> 48(sp)
arg10 -> 56(sp)

The bug is related to the fact that arg8 was not placed at 24(sp) as the callee expects.


Version-Release number of selected component (if applicable):
gcc-2.96-85
and
gcc-2.96-96

How Reproducible:
Every Time

Steps to Reproduce:
1. 
#include <stdio.h>

typedef  struct {
   long   low;
   long   high;
  } I128 ;

#define SHOW_BUG


void foo (
#if !defined(SHOW_BUG)
 int a0,
#endif
 int a1, 
 int a2, 
 int a3, 
 int a4, 
 int a5, 
 int a6, 
 int a7, 
 I128 a8, 
 I128 a9, 
 I128 a10) 
{
  printf("a1=%d \n",a1);
  printf("a2=%d \n",a2);
  printf("a3=%d \n",a3);
  printf("a4=%d \n",a4);
  printf("a5=%d \n",a5);
  printf("a6=%d \n",a6);
  printf("a7=%d \n",a7);
  printf("a8=(%d, %d) \n",a8.low, a8.high);
  printf("a9=(%d, %d)  << this should be (9,0)\n",a9.low, a9.high);
  printf("a10=(%d, %d)\n",a10.low, a10.high);
}


main ( )
{
  I128 a8={8,0};
  I128  a9={9,0};
  I128 a10 = {10,0};
  foo(
#if !defined(SHOW_BUG) 
     0,
#endif
     1,2,3,4,5,6,7,a8,a9,a10);
  return (0); 
}

2. 
3. 

Actual Results:
a1=1 
a2=2 
a3=3 
a4=4 
a5=5 
a6=6 
a7=7 
a8=(8, 0) 
a9=(65493, 9)  << this should be (9,0)
a10=(0, 10)


Expected Results:
a1=1 
a2=2 
a3=3 
a4=4 
a5=5 
a6=6 
a7=7 
a8=(8, 0) 
a9=(9, 0)  << this should be (9,0)
a10=(10,0)


Additional Information:
ia64 machine stepping level C0
Comment 1 John Kacur 2001-10-10 12:08:16 EDT
Problem still exists in
gcc-2.96-98

Problem does NOT occur in
gcc3-3.0.1-3
Comment 2 Jakub Jelinek 2001-10-17 09:14:44 EDT
This was fixed in gcc3 by:
http://gcc.gnu.org/ml/gcc-patches/2001-04/msg00642.html
Unfortunately, this cannot be applied, since this would break binary
compatibility.
Comment 3 John Kacur 2001-11-19 12:46:08 EST
Please close this bug.
I understand that the fix for this problem cannot be backported to gcc-2.96 because of binary-compatibility.

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