Re: Simple, easy multithreaded circular buffer library for Linux?

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

 



On Fri, Oct 17, 2008 at 02:33:00PM -0400, Paul Coccoli wrote:

> There's no chance that a compiler optimization is hiding the bug,
> because we haven't turned on optimization.

But there is nothing that stops the compiler from writing 
read_ptr any number of times it wants unless you make that
variable volatile.

>  HOWEVER, if you go back
> to the original version and REMOVE the volatile qualifiers, then
> re-compile with -O2, NOW a compiler optimization is hiding the bug
> (and the test passes)!  The rb->read_ptr is presumably cached in a
> register and hence only modified once (giving the same affect as the
> patch).

Indeed. The original version really invited the problem,
by *forcing* the compiler to write read_ptr twice.

Ciao,

-- 
FA

Laboratorio di Acustica ed Elettroacustica
Parma, Italia

Lascia la spina, cogli la rosa.

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux