https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85637

--- Comment #5 from petschy at gmail dot com ---
Thanks, in this specific case __restrict works indeed.

On a side note, is it possible to achieve the same when a char is stored
through a char* member, and also incremented? eg:

if (m_cur < m_end) 
    *m_cur = val;
++m_cur;

Since char* aliases everything, m_cur and m_end won't be kept in registers
properly as the compiler assumes that the store through *m_cur might have
changed them. No amount of __restrict pepper helped with this.

Is it far fetched to request an extension which can be turned on via a cmdline
flag and causes 'char* __restict p' to behave like any other restricted ptr, ie
not aliasing any other char*'s, let alone other types? Any serialization code
that uses classes to store the ptrs would benefit from this, as no more in-loop
re-load/store would be needed for the members.

Reply via email to