Re: how to avoid a memset() optimization

"Charles Bryant" <n1096001003.ch@chch.demon.co.uk>
1 Dec 2002 22:37:49 -0500

          From comp.compilers

Related articles
[11 earlier articles]
Re: how to avoid a memset() optimization usenet-1ugeabe@qeng-ho.org (Arthur Chance) (2002-11-13)
Re: how to avoid a memset() optimization cfc@shell01.TheWorld.com (Chris F Clark) (2002-11-15)
Re: how to avoid a memset() optimization usenet-1ugeabe@qeng-ho.org (Arthur Chance) (2002-11-15)
Re: how to avoid a memset() optimization joachim_d@gmx.de (Joachim Durchholz) (2002-11-17)
Re: how to avoid a memset() optimization cfc@shell01.TheWorld.com (Chris F Clark) (2002-11-20)
Re: how to avoid a memset() optimization thp@cs.ucr.edu (2002-11-24)
Re: how to avoid a memset() optimization n1096001003.ch@chch.demon.co.uk (Charles Bryant) (2002-12-01)
| List of all articles for this month |
From: "Charles Bryant" <n1096001003.ch@chch.demon.co.uk>
Newsgroups: comp.compilers
Date: 1 Dec 2002 22:37:49 -0500
Organization: Compilers Central
References: 02-11-030 02-11-069 02-11-084
Keywords: C, optimize
Posted-Date: 01 Dec 2002 22:37:48 EST



Chris F Clark <cfc@shell01.TheWorld.com> wrote:
... clearing memory for security and optimising it away ...
>Later the DEC group I consulted for(*), took this apporach even further,
>and wrote "OM" (object modifier) which took executable images (of
>machine language instructions) and optimized them. Thus, when OM was
>used to eliminate your dead-code, there was no hope (unless you wanted
>to construct your dead code in the data segment and jump into it),
>since even assembly language routines were susceptible to its reach.


Most CPUs have instructions other than normal stores which modify
memory. For example the SPARC has cas and ldstub. On the SPARC these
are explicitly for memory synchronisation, so any optimiser which
re-orders or deletes them is simply incorrect. On other architectures
there may instead be instructions which are too complex for an
optimiser to handle, or you could simply write code too complex for
the optimiser. Since, presumably, it isn't going to attempt to solve
the halting problem, there must be code which it cannot optimise away
but which has no effect.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.