Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2012 01:05:56 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239345 - head/lib/libc/stdlib
Message-ID:  <201208170105.q7H15uCi094877@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Fri Aug 17 01:05:56 2012
New Revision: 239345
URL: http://svn.freebsd.org/changeset/base/239345

Log:
  Make 'junk' volatile so that compilers won't be tempted to optimize
  
  Reviewed by:	ache
  MFC after:	3 days

Modified:
  head/lib/libc/stdlib/random.c

Modified: head/lib/libc/stdlib/random.c
==============================================================================
--- head/lib/libc/stdlib/random.c	Fri Aug 17 00:49:29 2012	(r239344)
+++ head/lib/libc/stdlib/random.c	Fri Aug 17 01:05:56 2012	(r239345)
@@ -315,7 +315,7 @@ srandomdev()
 
 	if (!done) {
 		struct timeval tv;
-		unsigned long junk;
+		volatile unsigned long junk;
 
 		gettimeofday(&tv, NULL);
 		srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208170105.q7H15uCi094877>