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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to