From: Jeffrey Walton <noloader@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Question on volatile functions and GCC
Date: Tue, 05 Mar 2013 19:00:00 -0000 [thread overview]
Message-ID: <CAH8yC8k-OKTtYwRTfs-npmKrr1zhJwVgyWA-XxwOd+3OHt71tA@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdRL0OQbkwzU5tzbMm=xqCoL1_9topSnWm7yiyj2dzBx6w@mail.gmail.com>
On Mon, Mar 4, 2013 at 6:46 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 4 March 2013 23:40, Jeffrey Walton wrote:
>> 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)
>> ;;
>> }
>
> This doesn't compile, it dereferences void. Did you mean p[--len] ?
Yes, my bad. Sorry - copy[paste was not available because the slide
was an umage.
>> How does a function become a 'volatile' memory mapped object related
>> to hardware?
>
> The function isn't volatile, the return type is. Qualifying void as
> volatile is meaningless, but allowed by the C grammar.
:)
Jeff
next prev parent reply other threads:[~2013-03-05 19:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 23:40 Jeffrey Walton
2013-03-04 23:46 ` Jonathan Wakely
2013-03-05 19:00 ` Jeffrey Walton [this message]
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
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=CAH8yC8k-OKTtYwRTfs-npmKrr1zhJwVgyWA-XxwOd+3OHt71tA@mail.gmail.com \
--to=noloader@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=jwakely.gcc@gmail.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).