svn commit: r357867 - head/tests/sys/net

Konstantin Belousov kostikbel at gmail.com
Thu Feb 13 21:33:31 UTC 2020


On Thu, Feb 13, 2020 at 07:05:19PM +0000, Li-Wen Hsu wrote:
> Author: lwhsu
> Date: Thu Feb 13 19:05:19 2020
> New Revision: 357867
> URL: https://svnweb.freebsd.org/changeset/base/357867
> 
> Log:
>   Fix GCC build.
>   
>   Sponsored by:	The FreeBSD Foundation
> 
> Modified:
>   head/tests/sys/net/randsleep.c
> 
> Modified: head/tests/sys/net/randsleep.c
> ==============================================================================
> --- head/tests/sys/net/randsleep.c	Thu Feb 13 19:05:14 2020	(r357866)
> +++ head/tests/sys/net/randsleep.c	Thu Feb 13 19:05:19 2020	(r357867)
> @@ -37,7 +37,7 @@
>  #include <stdlib.h>
>  #include <unistd.h>
>  
> -#define RANDOM_MAX ((1<<31) - 1)
> +#define RANDOM_MAX (((long)1<<31) - 1)
This still gives UB on ILP32 platforms.  I believe the better fix would be
(1u  << 31) - 1.

>  
>  int main(int argc, char** argv){
>  	useconds_t max_usecs, usecs;


More information about the svn-src-head mailing list