[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#164554: gcc-3.2: volatile not respected on alpha



On Tue, Oct 15, 2002 at 08:38:37AM +0200, Martin v. Loewis wrote:
> 
> In the code, there are two modifications to i, namely
> 
>  	i++;
>  	j = 6;
>  	i--;
> 
> So at the first sequence point, i should be incremented, and at the
> second sequence point, i should be decremented to its original value
> (regardless of the value of j, which does not need to be coordinated).
> AFAICT, in the sequence
> 
>  	ldq $3,i($29)		!literal
>  	lda $4,6($31)
>  	ldq $1,j($29)		!literal
>  	ldl $2,0($3)
>  	stl $4,0($1)
>  	lda $2,1($2)
>  	stl $2,0($3)
> 
> the value of i is never changed. Instead, it is loaded into $2, and
> then written back from $2 to i. That seems to be in violation of the
> volatile requirements to me.

I left out the assembly which decrements i, otherwise it is correct.
It's basically doing
	j = 6;
	i++;
	i--;
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Reply to: