From owner-freebsd-current@FreeBSD.ORG Sat Jun 12 17:37:37 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBA70106566C for ; Sat, 12 Jun 2010 17:37:37 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 9E3DA8FC14 for ; Sat, 12 Jun 2010 17:37:37 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id A1AEC1FFC33; Sat, 12 Jun 2010 17:37:36 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 983A184491; Sat, 12 Jun 2010 19:35:26 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: ticso@cicely.de References: <20100611162118.GR39829@acme.spoerlein.net> <867hm5tl6u.fsf@ds4.des.no> <20100612153526.GA3632@acme.spoerlein.net> <20100612163208.GS87112@cicely7.cicely.de> Date: Sat, 12 Jun 2010 19:35:26 +0200 In-Reply-To: <20100612163208.GS87112@cicely7.cicely.de> (Bernd Walter's message of "Sat, 12 Jun 2010 18:32:08 +0200") Message-ID: <864oh86tnl.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: current@freebsd.org Subject: Re: Cleanup for cryptographic algorithms vs. compiler optimizations X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jun 2010 17:37:37 -0000 Bernd Walter writes: > I'm not sure when removing a memset is allowed. Always, if the compiler can determine that the data will not be used later. In more general terms, the compiler is allowed to make any changes it likes to the program as long as the end result behaves exactly like it would if it hadn't been changed. This is called the "as if" rule. For instance, if you call printf() or fprintf() with a format string that does not contain any conversion specifiers, gcc will call gets() or fgets() instead. > Maybe passing volatile pointers might be enough. You can't pass a volatile pointer to memset. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no