From owner-freebsd-current@FreeBSD.ORG Sun Jun 13 16:28:55 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 95ABE1065670 for ; Sun, 13 Jun 2010 16:28:55 +0000 (UTC) (envelope-from ticso@cicely7.cicely.de) Received: from raven.bwct.de (raven.bwct.de [85.159.14.73]) by mx1.freebsd.org (Postfix) with ESMTP id F10C78FC08 for ; Sun, 13 Jun 2010 16:28:54 +0000 (UTC) Received: from mail.cicely.de ([10.1.1.37]) by raven.bwct.de (8.13.4/8.13.4) with ESMTP id o5DGSrFK008727 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 13 Jun 2010 18:28:53 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (cicely7.cicely.de [10.1.1.9]) by mail.cicely.de (8.14.3/8.14.3) with ESMTP id o5DGSfBR060308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 13 Jun 2010 18:28:41 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: from cicely7.cicely.de (localhost [127.0.0.1]) by cicely7.cicely.de (8.14.2/8.14.2) with ESMTP id o5DGSfIc002922; Sun, 13 Jun 2010 18:28:41 +0200 (CEST) (envelope-from ticso@cicely7.cicely.de) Received: (from ticso@localhost) by cicely7.cicely.de (8.14.2/8.14.2/Submit) id o5DGSfX8002921; Sun, 13 Jun 2010 18:28:41 +0200 (CEST) (envelope-from ticso) Date: Sun, 13 Jun 2010 18:28:41 +0200 From: Bernd Walter To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Message-ID: <20100613162841.GE87112@cicely7.cicely.de> References: <20100611162118.GR39829@acme.spoerlein.net> <867hm5tl6u.fsf@ds4.des.no> <20100612153526.GA3632@acme.spoerlein.net> <20100612163208.GS87112@cicely7.cicely.de> <864oh86tnl.fsf@ds4.des.no> <20100612225216.GT87112@cicely7.cicely.de> <86k4q33pk2.fsf@ds4.des.no> <20100613160035.GD87112@cicely7.cicely.de> <86fx0q52r0.fsf@ds4.des.no> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86fx0q52r0.fsf@ds4.des.no> X-Operating-System: FreeBSD cicely7.cicely.de 7.0-STABLE i386 User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED=-1, BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 autolearn=unavailable version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on spamd.cicely.de Cc: ticso@cicely.de, 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 Reply-To: ticso@cicely.de List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2010 16:28:55 -0000 On Sun, Jun 13, 2010 at 06:14:11PM +0200, Dag-Erling Smørgrav wrote: > Bernd Walter writes: > > Dag-Erling Smørgrav writes: > > > Bernd Walter writes: > > > > Amazing - this is one of the things which can get nasty if you try > > > > some kind of microtuning. > > > Only if you break the rules. Bad code is always bad, even if it > > > sometimes works by accident. > > To expect that function calls are replaced with other functions isn't a > > very obvious rule. > > You don't need to know that gcc replaces printf() with puts(). That's > the whole point of the as-if rule: the compiler can only modify the > program in ways that do not change observable behavior. Well in ways the compiler _thinks_ it is not observeable. I'm not saying that it is doing wrong per definition, but if it is really not observeable and obvious we wouldn't need to talk about it. > The only way you can tell that gcc did it is if you break the rules, > such as by defining your own version of printf() or puts(). Our loader stages do this for good reasons. And in microcontroller programming (surely out of FreeBSD scope) it is done very regulary. All I say is that the rules are not obvious in many cases. Most people using compilers don't have the deep knowledge as you have. Of course we are talking about corner cases which most people also never have to face. In any case - I've learned something new. -- B.Walter http://www.bwct.de Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.