This is the mail archive of the gcc-bugs@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]

[Bug target/14262] Structure size computed wrong


------- Additional Comments From fjahanian at apple dot com  2004-06-23 20:46 -------
Our (Apple's consensus) is that we will not break ABI compatibility between our gcc3.3 and
our gcc3.5. We will change Apple's ABI documentation to reflect gcc3.3 (and our gcc3.5's)
behaviour. This patch, however, has done two things for apple-ppc-darwin platform.

1 ). It has broken Apple's ABI compatibility when structs are 3 bytes.

2) It has broken following test case, regardless, in the FSF mainline for apple-ppc-darwin.
    Specifically, change to routine load_register_parameters in calls.c has done it.

extern void abort (void);

void bar (int n, int c)
{
  if (c != (char) (0 ^ (n << 3)))
    abort ();
}


typedef struct { char x[3]; } A3;

void foo (int size, ...)
{

        A3 a3;
        __builtin_va_list ap;
        __builtin_va_start(ap,size);

        a3 = __builtin_va_arg(ap,typeof (a3));

        printf("a3.x[0] = %d\n", a3.x[0]);
        bar (3, a3.x[0]);

        __builtin_va_end(ap);

}

int main (void)
{

  A3 a3;
  a3.x[0] = 0 ^ (3 << 3);
  printf("a3.x[0] = %d\n", a3.x[0]);
  foo (21 , a3);
  return 0;
}

[jahan5:sandbox/radars/3702185] fjahania% mygccm5o pr14262.broken.c
[jahan5:sandbox/radars/3702185] fjahania% ./a.out
a3.x[0] = 24
a3.x[0] = 0
Abort

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fjahanian at apple dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14262


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