Kerberos 64 bit compiles

Ken Raeburn raeburn at MIT.EDU
Tue Dec 17 17:34:00 EST 2002


I wrote:
> The failing configuration was the Red Hat Linux 7.1 installation on
> our test machine, with gcc-2.96.  We have a small number of places in
> our code that pass structures around as function arguments, and this
> version of gcc compiles them incorrectly on IA64.  Once upon a time,
> this was a pretty unreliable thing to do, but it's been a standard
> part of C for a long time now, so I'm not inclined to root out and
> change all instances of it in our code.

Here's my test program, and the test results from defining the passed
structure to have various sizes with the Red Hat compiler.  Try it out
on your system; if it doesn't produce the correct result, you're
probably running into the same bug.

    /* Define X as some small number at compile time.
       If X is 1..6, the output is 173, which is correct.
       7 => 65548; 8,10,12,14 => 56; 9,11 => 65610; 13 => 65596; 15 => 65653
       Etc.  Clearly structures of 60 bytes and up aren't being passed
       around properly.  */
    #include <stdio.h>
    struct a { int a1; void *a2[X]; }; /* size depends on -DX=## */
    static int f1 (int b, struct a c, struct a d, int e); /* not pointers! */
    struct a A1 = { 42 }, A2 = { 19 };
    int main () {
      int x = f1 (13, A1, A2, 99);
      printf ("x = %d\n", x);
      return 0;
    }

    static int f1 (int b, struct a c, struct a d, int e) {
      return b + c.a1 + d.a1 + e;
    }

Ken



More information about the Kerberos mailing list