svn commit: r207330 - head/sys/dev/sound/pcm

Andriy Gapon avg at freebsd.org
Thu Apr 29 05:45:47 UTC 2010


on 28/04/2010 20:26 Jung-uk Kim said the following:
> Author: jkim
> Date: Wed Apr 28 17:26:05 2010
> New Revision: 207330
> URL: http://svn.freebsd.org/changeset/base/207330
> 
> Log:
>   Remove dead code.  Calculated greatest common divisor was not used at all.
>   On top of that, LLVM+Clang mis-compiles this code because of its register
>   allocator bug.
>   
>   Analyzed by:	Andrew Reilly (areilly at bigpond dot net dot au)
>   Reviewed by:	ariff, rdivacky
>   MFC after:	3 days


I think that we also owe an attribution to Alexander Best <alexbestms at wwu.de>,
who discovered the problem, reported it and did an immense job of narrowing it
down to a single function.

> Modified:
>   head/sys/dev/sound/pcm/buffer.c
> 
> Modified: head/sys/dev/sound/pcm/buffer.c
> ==============================================================================
> --- head/sys/dev/sound/pcm/buffer.c	Wed Apr 28 15:38:01 2010	(r207329)
> +++ head/sys/dev/sound/pcm/buffer.c	Wed Apr 28 17:26:05 2010	(r207330)
> @@ -568,7 +568,6 @@ sndbuf_updateprevtotal(struct snd_dbuf *
>  unsigned int
>  snd_xbytes(unsigned int v, unsigned int from, unsigned int to)
>  {
> -	unsigned int w, x, y;
>  
>  	if (from == to)
>  		return v;
> @@ -576,16 +575,6 @@ snd_xbytes(unsigned int v, unsigned int 
>  	if (from == 0 || to == 0 || v == 0)
>  		return 0;
>  
> -	x = from;
> -	y = to;
> -	while (y != 0) {
> -		w = x % y;
> -		x = y;
> -		y = w;
> -	}
> -	from /= x;
> -	to /= x;
> -
>  	return (unsigned int)(((u_int64_t)v * to) / from);
>  }
>  


-- 
Andriy Gapon


More information about the svn-src-all mailing list