Related articles |
---|
[2 earlier articles] |
Re: how to avoid a memset() optimization alexc@world.std.com (Alex Colvin) (2002-11-08) |
Re: how to avoid a memset() optimization fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-11-12) |
Re: how to avoid a memset() optimization christian.bau@freeserve.co.uk (Christian Bau) (2002-11-12) |
Re: how to avoid a memset() optimization lars@bearnip.com (Lars Duening) (2002-11-12) |
Re: how to avoid a memset() optimization cgweav@aol.com (Clayton Weaver) (2002-11-12) |
Re: how to avoid a memset() optimization n2102139816.ch@chch.demon.co.uk (Charles Bryant) (2002-11-13) |
Re: how to avoid a memset() optimization dobes@dobesland.com (Dobes Vandermeer) (2002-11-13) |
Re: how to avoid a memset() optimization fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-11-13) |
Re: how to avoid a memset() optimization jvorbrueggen@mediasec.de (Jan C. =?iso-8859-1?Q?Vorbr=FCggen?=) (2002-11-13) |
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) |
[3 later articles] |
From: | "Dobes Vandermeer" <dobes@dobesland.com> |
Newsgroups: | comp.compilers |
Date: | 13 Nov 2002 12:17:54 -0500 |
Organization: | Compilers Central |
References: | 02-11-030 02-11-040 02-11-049 |
Keywords: | C, standards, optimize |
Posted-Date: | 13 Nov 2002 12:17:54 EST |
Lars Duening wrote:
>
> Alex Colvin <alexc@world.std.com> wrote:
>
> > "Francis Wai" <fwai@rsasecurity.com> writes:
> >
> > ...the case of a memory scrub optimized away by the compiler...
> >
> > >Various suggestions have been made, such as declaring the variable
> > >volatile and having a scrub memory function in a file of its own. I'm
> > >wondering if there are better ways such as telling the compiler not to
> > >optimize away a function call.
> >
>
> #pragma eliminate_dead_code=no
> memset(key, 0, sizeof key);
> #pragma eliminate_dead_code=restore
Maybe I'm just silly, but isn't changing memset() so that it can be
optimized away just plain pointless?
The point of an automated optimizer is to perform optimizations that
can't be done in the source language, or that would be too ugly to do.
How often do programmers accidentally leave "dead" memset() calls in
their code, and is it worth the compiler's effort to remove these?
Maybe its to improve performance of badly generated code, which contains
a lot of dead memset() calls?
I suppose its possible that not just memset(), but a whole class of
functions are being targetted here. Perhaps even a solution like:
void *safe_memset(void *buf, int c, size_t len) { memset(buf, c, len); }
would be detected and removed?
CU
Dobes
[No need. See later messages. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.