public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on volatile functions and GCC
@ 2013-03-04 23:40 Jeffrey Walton
  2013-03-04 23:46 ` Jonathan Wakely
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jeffrey Walton @ 2013-03-04 23:40 UTC (permalink / raw)
  To: gcc-help

Hi All,

I was looking at some slides on OpenSSL and secure memory wiping using
volatile (Slide 36 at
http://www.slideshare.net/guanzhi/crypto-with-openssl).

I believe GCC's interpretation of the use for 'volatile' is memory
mapped hardware. I think Ian stated it for me some time ago when I was
trying to understand different interpretations among compilers. If
volatile is for memory mapped hardware, why does GCC compile the
following:

volatile void clean_memory(volatile void* dest, size_t len)
{
  volatile unsigned char* p;
  for(p = (volatile unsigned char*)dest; len; dest[--len] = 0)
    ;;
}

How does a function become a 'volatile' memory mapped object related
to hardware?

Jeff

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-06 10:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 23:40 Question on volatile functions and GCC Jeffrey Walton
2013-03-04 23:46 ` Jonathan Wakely
2013-03-05 19:00   ` Jeffrey Walton
2013-03-05  9:28 ` David Paterson
2013-03-05  9:40   ` Jonathan Wakely
2013-03-05  9:58     ` David Paterson
2013-03-05 10:19       ` David Brown
2013-03-05 14:35       ` Ian Lance Taylor
2013-03-05 10:14     ` Tobias Burnus
2013-03-05 18:39   ` Jeffrey Walton
2013-03-06 10:22     ` Andrew Haley
2013-03-05  9:46 ` Georg-Johann Lay

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 read-only IMAP folder(s) and NNTP newsgroup(s).