This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: volatile const structure members in C++
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Ian Lance Taylor <ian at airs dot com>
- Cc: Steve Zook <Steve at Zook dot com>, gcc-help at gcc dot gnu dot org
- Date: Fri, 26 Aug 2005 13:02:24 -0400
- Subject: Re: volatile const structure members in C++
- References: <auto-000008119529@dberlin.org> <1125061413.26086.3.camel@linux.site> <m3hddcy6rz.fsf@gossamer.airs.com>
On Fri, 2005-08-26 at 09:58 -0700, Ian Lance Taylor wrote:
> Daniel Berlin <dberlin@dberlin.org> writes:
>
> > On Thu, 2005-08-25 at 21:24 -0700, Steve Zook wrote:
> > > Using m68k-elf-gcc with either revision 3.3.3 or 3.4.4, I compile the
> > > following test program (as a C++ program) at -O2 to an object file:
> > >
> > >
> > > struct sA { unsigned volatile const B;
> > > unsigned volatile C;
> > > unsigned const D;
> > > unsigned E; };
> > > void Function( sA & A ) { A.B; A.C; A.D; A.E; }
> > >
> > >
> > > The object file I get looks like (edited for brevity):
> > >
> > > .globl _Z8FunctionR2sA
> > > .type _Z8FunctionR2sA, @function
> > > _Z8FunctionR2sA:
> > > link.w %a6,#0
> > > move.l 8(%a6),%a0 | A, A
> >
> > This is a load of A.B. It's the first member of the structure, and
> > thus, is at offset 0, and is also known as "A".
>
> No, that's a load of the address of A--i.e., loading the argument into
> a register. On the m68k arguments are passed on the stack.
Oh, okay :)
> To
> actually load A.B, rather than just the address of A.B, would require
> a following
> move.l 0(%a0),....
>
> Ian