[cfe-dev] [RFC] add Function Attribute to disable optimization

Robinson, Paul Paul_Robinson at playstation.sony.com
Tue Jun 18 10:28:25 PDT 2013


This thread is about defining an attribute to disable optimization on an
individual function.

Please let's not hijack it into a discussion of 'volatile'?

Thanks.
--paulr

> -----Original Message-----
> From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu]
> On Behalf Of Jeffrey Walton
> Sent: Monday, June 17, 2013 11:04 PM
> To: Joshua Cranmer
> Cc: cfe-dev at cs.uiuc.edu
> Subject: Re: [cfe-dev] [RFC] add Function Attribute to disable
> optimization
> 
> On Tue, Jun 18, 2013 at 1:16 AM, Joshua Cranmer <pidgeot18 at gmail.com>
> wrote:
> > On 6/17/2013 7:23 PM, Jeffrey Walton wrote:
> >>
> >> Microsoft was not the problem - it was GCC since the only use of
> volatile
> >> is memory mapped hardware.
> >
> > That is a gross misrepresentation of volatile, I think.
> Well... "The volatile qualifier is designed for working with memory
> mapped hardware,"
> http://gcc.gnu.org/ml/gcc-help/2012-03/msg00242.html.
> 
> (For what its worth, I don't disagree with you. Its a PITA to work
> around GCC at times when the code is otherwise portable).
> 
> > ...
> >> volatile void clean_memory(volatile void* dest, size_t len)
> >> {
> >>      volatile unsigned char* p;
> >>      for(p = (volatile unsigned char*)dest; len; dest[--len] = 0)
> >>        ;;
> >> }
> >>
> >> Because the pointers above ('dest' and `p`) were not memory mapped
> >> addresses, the GCC folks consider it an abuse.
> >
> > Did you actively ask them this question, or are you surmising from
> what
> > you've read on lists?
> Yes, it was actively asked. I lifted it a bit because I knew that
> volatile was reserved for memory mapped addresses in GCC (from
> previous discussions). This question asked how a function could be
> volatile if the qualifier was reserved for memory mapped addresses.
> http://gcc.gnu.org/ml/gcc-help/2013-03/msg00024.html.
> 
> > For your use case--zeroing out memory so people can't
> > sneak read your memory map [1]--I would consider it a valid use
> myself; I
> > would be surprised if a compiler developer disagreed with this solely
> on the
> > basis that it's not clearing out a memory mapped address space.
> Yes, its crypto. You should see they way OpenSSL handles it (see
> OpenSSL_cleanse).
> 
> Jeff
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list