[improved-aliasing]: Better clobbering and clobber stats
Richard Henderson
rth@redhat.com
Thu Sep 29 21:41:00 GMT 2005
On Thu, Sep 29, 2005 at 01:02:19PM -0400, Daniel Berlin wrote:
> This improves our local clobbering by teaching it that things that
> escape through calls can't escape through calls that don't have writable
> pointer arguments.
What do you mean by this? Don't have "written pointer arguments"
because you're doing IPA and have looked at the implementation to
see that it is true? Using the non-user accessible "no vops"
attribute? Looking at "const" on the pointer argument?
It looks to me that you're doing the last. Which is incorrect.
It's valid C to cast away const. It's only invalid to reference
the object through the non-const pointer if the original object
is const qualified. Thus
void f(const int *x) { *(int *)x = 0; }
void g() { int x = 1; f(&x); }
is a valid program, while
void g() { const int x = 1; f(&x); }
is not.
r~
More information about the Gcc-patches
mailing list