This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] if-conversion of loops with conditionals containing memory loads and stores
On Wed, Jun 23, 2010 at 14:04, Joseph S. Myers <joseph@codesourcery.com> wrote:
> Not just the C++0x memory model, but you also need to be sure that A[i] is
> a valid pointer to writable memory - not an out-of-range or unaligned
> pointer (if A[i] is always *read*, you can be sure of that, and simply
> forming the address &A[i] means it is either valid or one past the end of
> an array),
The patch 0010 tries to prove that the data reference A[i] occurs either
in read or write mode at every iteration of the loop.
> not a pointer to readonly memory (remember that in C it's valid
> to cast a pointer-to-const to pointer-to-non-const, so just because the
> target type isn't const qualified doesn't mean you can actually write to
> the memory).
I have not checked this. So if I understand correctly, to prove that
an array is not const qualified, one has to prove that there exists at
least one unconditional write to the array.
Thanks,
Sebastian