Re: Fw: Possible missed optimization opportunity with const?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Florian Weimer wrote:

>> On 08/31/2016 10:57 AM, Toshi Morita wrote: 
>> 
>> However, if the definition of pfoo is changed to: const int * const pfoo = (const int * const 0x1234);
>> the optimization seems to fail:
> 
> The optimization is not valid in this case because the compiler cannot know that the object was declared const.
> It could well be mutable.

Sorry, that should be:

const int * const pfoo = (const int * const)0x1234;

So assuming this is still wrong, what is the correct way to define a pointer to a hardware register at 0x1234 which contains immutable data? I'm missing something here.

Toshi



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux