Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2010 12:44:03 +0200
From:      "Matthias Andree" <matthias.andree@gmx.de>
To:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: Cleanup for cryptographic algorithms vs. compiler optimizations
Message-ID:  <op.vd8irpye1e62zd@merlin.emma.line.org>
In-Reply-To: <20100612225216.GT87112@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>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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