This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [improved-aliasing]: Better clobbering and clobber stats
- From: Richard Henderson <rth at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 29 Sep 2005 14:40:52 -0700
- Subject: Re: [improved-aliasing]: Better clobbering and clobber stats
- References: <1128013339.9435.9.camel@IBM-82ZWS052TEN.watson.ibm.com>
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~