9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Douglas A. Gwyn" <DAGwyn@null.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] how to avoid a memset() optimization
Date: Thu, 14 Nov 2002 10:22:07 +0000	[thread overview]
Message-ID: <3DD35C73.8090404@null.net> (raw)
In-Reply-To: <51251da60e579ed6058e741fa0dbff7b@plan9.bell-labs.com>

Russ Cox wrote:
> This is a stupid argument anyway.  Volatile is a crock.
> Here's another problem.  Suppose I'm worried that
> leaking the processor flags at the end of my computation
> might reveal something about the secret key.  I want to
> clear them.  I could do something like:
> 	x = 0 & 0;
> which in this particular case will clear the appropriate
> flags.  But now the compiler comes along and optimizes
> away the whole expression.  Where do I put my volatile
> to make that stay?  Hmm?  The answer is not more crappy
> qualifiers.  The answer is clearly dumber compilers.

Do you really want the compiler to always generate code
	MOV	R1,#0
	MOV	R2,#0
	AND	R2,R1
	MOV	R2,X(SP)
?  Almost any modern compiler will peform the AND at
compiler time (constant folding), and most customers want
that.  Anyway, I don't see why you need to AND in this
context.  Are you talking about the C and V bits?  If some
other process can inspect those for your process I'd think
it could inspect a whole lot more..

It is certainly true that we could really use better access
to the C bit from higher-level language source code.  This
shows up especially in the MP library.  But exploiting too
specific knowledge about the workings of a specific platform
can be dangerous, as we've seen historically.  If anybody
can devise a *nice* way to get at the C bit in MP coding,
please let me know so that it can be proposed for C0x.


  reply	other threads:[~2002-11-14 10:22 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-14  6:53 Russ Cox
2002-11-14 10:22 ` Douglas A. Gwyn [this message]
2002-11-14 13:20   ` Sam
2002-11-14 15:20     ` Scott Schwartz
2002-11-14 15:26       ` Boyd Roberts
2002-11-14 15:34         ` plan9
2002-11-14 15:59           ` Sam
2002-11-14 18:57         ` Steve Kilbane
2002-11-15 10:51           ` Douglas A. Gwyn
2002-11-14 15:50       ` Dan Cross
2002-11-14 17:21         ` Douglas A. Gwyn
2002-11-14 18:51           ` Dan Cross
2002-11-14 15:50     ` Douglas A. Gwyn
2002-11-19  7:20 ` Roman V. Shaposhnick
     [not found] <sah@softcardsystems.com>
2003-02-15 14:30 ` [9fans] presentation preparation Sam
2003-02-15 19:37   ` Scott Schwartz
2003-02-15 19:48     ` andrey mirtchovski
2003-02-27  9:35       ` Ralph Corderoy
2003-02-28 18:44         ` [9fans] union directories Jack Johnson
2003-02-28 18:53           ` Russ Cox
2003-03-04  9:44           ` Adrian Tritschler
2003-02-15 20:49   ` [9fans] presentation preparation Richard Miller
2003-02-17 15:00   ` Russ Cox
2003-02-17 16:25     ` Fco.J.Ballesteros
  -- strict thread matches above, loose matches on Subject: below --
2003-01-06 10:47 [9fans] how to avoid a memset() optimization nigel
2003-01-06 11:15 ` Geoff Collyer
2002-11-19 14:32 presotto
2002-11-20  7:24 ` Tomas
2002-11-20 16:38   ` Douglas A. Gwyn
2002-11-19  8:21 Fco.J.Ballesteros
2002-11-18 21:36 Joel Salomon
2002-11-18 20:42 Andrew Simmons
2002-11-18 14:19 C H Forsyth
2002-11-15  1:56 Dennis Ritchie
2002-11-15 10:51 ` Douglas A. Gwyn
2002-11-15 12:03 ` Boyd Roberts
2002-11-14 18:55 jmk
2002-11-14 22:23 ` Steve Kilbane
2002-11-14 18:17 presotto
2002-11-14 18:11 Joel Salomon
2002-11-14 18:26 ` William Josephson
2002-11-14 17:44 rog
2002-11-15 10:50 ` Douglas A. Gwyn
2002-11-14 17:28 Russ Cox
2002-11-14 16:47 presotto
2002-11-15 10:50 ` Douglas A. Gwyn
2002-11-15 16:51   ` William Josephson
2002-11-18 10:38     ` Douglas A. Gwyn
2002-11-18 12:34       ` Ronald G. Minnich
2002-11-19  7:38 ` Roman V. Shaposhnick
2002-11-20  9:47   ` Douglas A. Gwyn
2002-11-21 20:55     ` Roman V. Shaposhnick
2002-11-22  9:59       ` Douglas A. Gwyn
2003-01-06 10:18   ` Ralph Corderoy
2003-01-06 15:42     ` Sam
2003-01-06 15:49       ` Russ Cox
2003-01-06 15:58         ` David Presotto
2003-01-06 16:02         ` Sam
     [not found] <nemo@plan9.escet.urjc.es>
2002-11-14 15:38 ` Fco.J.Ballesteros
2002-11-14 16:24   ` Scott Schwartz
2002-11-14  2:48 Dennis Ritchie
2002-11-14  4:23 ` Ronald G. Minnich
2002-11-13 18:58 Rob `Commander' Pike
2002-11-13 14:40 C H Forsyth
2002-11-13 15:54 ` rob pike
2002-11-13 16:05   ` andrey mirtchovski
2002-11-13 16:32   ` Ronald G. Minnich
2002-11-14 10:21     ` Douglas A. Gwyn
2002-11-14 17:07       ` Ronald G. Minnich
2002-11-22  9:59     ` Clint Olsen
2002-11-13 16:56   ` William K. Josephson
2002-11-14 10:21     ` Douglas A. Gwyn
2002-11-14 16:48       ` William Josephson
2002-11-14 10:21   ` Douglas A. Gwyn
2002-11-14 14:46     ` Dan Cross
2002-11-14 16:59       ` Douglas A. Gwyn
2002-11-14 18:31         ` Tad Hunt
2002-11-15 10:50           ` Douglas A. Gwyn
2002-11-18 14:27         ` Aharon Robbins
2002-11-13 14:14 Skip Tavakkolian
2002-11-13 13:55 rog
2002-11-13 13:38 Skip Tavakkolian
2002-11-13 16:25 ` Boyd Roberts
2002-11-13 10:43 C H Forsyth
2002-11-14 10:21 ` Douglas A. Gwyn
2002-11-13  6:52 Geoff Collyer
2002-11-13 10:13 ` Boyd Roberts
2002-11-13  6:34 Andrew Simmons
2002-11-13  6:43 ` Doc Shipley
2002-11-13  1:47 Russ Cox
2002-11-13 10:16 ` Douglas A. Gwyn
2002-11-14  1:46 ` Roman V. Shaposhnick
2002-11-14  1:52   ` William Josephson
2002-11-14  6:42     ` Roman V. Shaposhnick
2002-11-13  0:31 Russ Cox
2002-11-13  1:26 ` Roman V. Shaposhnick
2002-11-13 10:15   ` Douglas A. Gwyn
2002-11-14  1:42     ` Roman V. Shaposhnick
2002-11-13 10:15 ` Douglas A. Gwyn
2002-11-13  0:20 presotto
2002-11-12 22:42 Roman V. Shaposhnick
2002-07-16 15:53 [9fans] useful language extension, or no? rob pike, esq.
2002-07-16 15:05 ` Sam
2002-07-16 21:29   ` Steve Kilbane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DD35C73.8090404@null.net \
    --to=dagwyn@null.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).