Fw: Possible missed optimization opportunity with const?

Florian Weimer fweimer@redhat.com
Thu Sep 1 19:19:00 GMT 2016


On 09/01/2016 09:11 PM, Toshi Morita wrote:

> I suspect when the C front-end parses (const int * const)0x1234, it fails
> to apply the const_tree attribute to the subtree, and this is why the
> optimization is failing.

The optimization is not failing—it results in *invalid code* if the 
compiler cannot observe that the pointer points to a const object.  For 
pointers, const does not mean immutable.

Florian



More information about the Gcc-help mailing list