This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

analysis #2: alpha bootstrap failure on mainline


> Digging deeper it turns out that the bug isn't actually in the
> preprocessor code at all, but somewhere else in the compiler
> resulting in cppexp.o being miscompiled during bootstrap.

Ok, I've managed to reduce the current alpha bootstrap failure
to a simple test case:

typedef struct
{
  unsigned long a;
  unsigned long b;
  unsigned char c;
  unsigned char d;
} cpp_num;

static cpp_num foo(cpp_num x, cpp_num y)
{
  printf("x2 = (%ld,%ld,%d,%d)\n",x.a,x.b,x.c,x.d);
  printf("y2 = (%ld,%ld,%d,%d)\n",y.a,y.b,y.c,y.d);
  return y;
}

int main()
{
  cpp_num x,y;

  x.a = 0;  x.b = 3;  x.c = 0;  x.d = 0;
  y.a = 0;  y.b = 4;  y.c = 0;  y.d = 0;

  printf("x1 = (%ld,%ld,%d,%d)\n",x.a,x.b,x.c,x.d);
  printf("y1 = (%ld,%ld,%d,%d)\n",y.a,y.b,y.c,y.d);
  x = foo(x,y);
  printf("x3 = (%ld,%ld,%d,%d)\n",x.a,x.b,x.c,x.d);
  return 0;
}


which when compiled with "stage1/xgcc -Bstage1/ fail.c" produces:

alpha% ./a.out
x1 = (0,3,0,0)
y1 = (0,4,0,0)
x2 = (0,3,0,0)
y2 = (0,4,12,17)
x3 = (0,4,12,17)


So it looks like the regression is in the code that passes parameters
on the stack and/or in registers.  Changing the return type of the
function to "void" cures the problem.

Unfortunately, parameter passing conventions and encodings *really*
aren't my area of expertise.  Hopefully, the example above should be
enough for someone more qualified than I to work from.

Have there been any recent changes to how multiple structures that
aren't a multiple of a word size are passed to functions that return
structures?  Does anyone recognize this?

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]