Thanks,

That clears it.

Sergei

> -----Original Message-----
> From: mspgcc-users-ad...@lists.sourceforge.net 
> [mailto:mspgcc-users-ad...@lists.sourceforge.net] On Behalf 
> Of Dmitry K.
> Sent: Tuesday, April 06, 2004 4:57 PM
> To: mspgcc-users@lists.sourceforge.net
> Subject: Re: [Mspgcc-users] [msp430] Anybody notice some of 
> these bugs?
> 
> 
> as 7 Apr 2004 03:33 Sergei Sharonov wrote:
> >
> > -------------------
> > volatile short *pbuf, *plast;
> >
> > int main(void)
> > {
> >   short buf[10];
> >   pbuf = buf;
> >   plast = buf + 10;
> >   while(pbuf < plast);
> >   return 0;
> > }
> >
> > void foo(void) /* called from interrupt */
> > {
> >   if(pbuf <= plast)  *pbuf++ = 0;
> > }
> >
> > -----------
> > Compiles into:
> >
> >   while(pbuf < plast);
> >     4054:   0f 9e           cmp     r14,    r15     ;
> >     4056:   fe 2b           jnc     $-2             ;abs 0x4054
> >
> > > 2. volatile var updates every time after 'volatile value' updated.
> >
> > See above.
> >
> 
> Compiler is right.
> 
> Variables in buf[10] are volatiles in this example.
> Try another place of word `volatile':
> 
>    short * volatile pbuf, * volatile plast;
> 
> Now volatiles are pointers:
> 
>    .L2:
>         mov     &pbuf, r14
>         mov     &plast, r15
>         cmp     r15, r14
>         jlo     .L2
> 
> Best regards.
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> 

Reply via email to