From owner-freebsd-current@FreeBSD.ORG Sun Jun 13 10:44:08 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47D581065674 for ; Sun, 13 Jun 2010 10:44:08 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 876D68FC1B for ; Sun, 13 Jun 2010 10:44:07 +0000 (UTC) Received: (qmail invoked by alias); 13 Jun 2010 10:44:05 -0000 Received: from g227137149.adsl.alicedsl.de (EHLO mandree.no-ip.org) [92.227.137.149] by mail.gmx.net (mp056) with SMTP; 13 Jun 2010 12:44:05 +0200 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX1/Innh+mBTIPj8OE2troAe79j2ODhpk858S8TxYZD pyBGk5E1ajNkOy Received: from merlin.emma.line.org (localhost [127.0.0.1]) by merlin.emma.line.org (Postfix) with ESMTP id 6C29094831 for ; Sun, 13 Jun 2010 12:44:04 +0200 (CEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "freebsd-current@freebsd.org" 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> Date: Sun, 13 Jun 2010 12:44:03 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Matthias Andree" Organization: Message-ID: In-Reply-To: <20100612225216.GT87112@cicely7.cicely.de> User-Agent: Opera Mail/10.53 (Linux) X-Y-GMX-Trusted: 0 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: Sun, 13 Jun 2010 10:44:08 -0000 Am 13.06.2010, 00:52 Uhr, schrieb Bernd Walter: >> 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. > > Amazing - this is one of the things which can get nasty if you try some > kind of microtuning. > Recently I had to implement my own atoi on a controller because using the > library one magically had blown my RAM usage by 1k on a controller with > just 8k RAM. There are certain compiler flags to affect that. For GCC, -Os is one (which doesn't necessarily work in FreeBSD though, on some versions the compiler would go into unterminated loop, leak memory and ultimately fail with OOM), flags to tell the compiler that the implementation is freestanding, and attributes to select builtins and the likes. -- Matthias Andree