[GCC-XML] offset attribute problem

Kang, Gene Y (N-Simulogix) gene.y.kang at lmco.com
Tue Oct 12 18:19:48 EDT 2004


Brad, I had to make a few modifications to get the test code to run on
my box:

#include "stdio.h"
#include "stddef.h"

struct A
{
   int x;
   int y;
};

int main()
{
   printf("%lu\n", offsetof(struct A, y));
   return 0;
}



The resulting output from running was 4.  I'm using gcc3.2.



-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com]
Sent: Tuesday, October 12, 2004 3:04 PM
To: Kang, Gene Y (N-Simulogix)
Cc: gccxml at gccxml.org
Subject: Re: [GCC-XML] offset attribute problem


Kang, Gene Y (N-Simulogix) wrote:

> Hello,  I'm having a problem with the latest CVS version of gccxml on
my Sun box.  It seems I always get a 0 for the offset attribute.  My
platform is Sun Sparc running Solaris 8.  Any ideas where I should start
looking to debug this problem ?  By the way, I've built the same CVS
version for my G5 running Mac OSX and the offset attribute seemed to be
set correctly.

Try compiling this program with GCC on your Sun:

------------------------------------------
#include <stdio.h>

struct A
{
   int x;
   int y;
};

int main()
{
   printf("%lu\n", offsetof(A, y));
   return 0;
}
------------------------------------------

What is the output from running it?

-Brad




More information about the gccxml mailing list