This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to implement `restrict' in C
On Sat, Oct 10, 1998 at 08:53:39PM -0700, Mark Mitchell wrote:
> Richard> But if the assignment `q = p' did not exist, then Q could
> Richard> not be said to be based on P and so there is no aliasing
> Richard> possible.
>
> Right. But, you can't tell this apriori.
If you mean on any isolated statement, you are correct.
I guess I was misinterpreting you to mean that you couldn't tell
if p and q aliased even at the beginning of the block.
> Correct. Note that if, by some data flow analysis, you can show that
> b is never assigned to, you can make the alias set for `b' be a subset
> of `int', and then get the benefit you would hope for.
That sounds backwards. Consider
void foo(int * restrict a, int *b, int *c);
Whether or not `b' is assigned to, we cannot make its alias set a
subset of int, since it may have aliased `c' from the very start.
But unless there exists some expression that causes `b' to be based
on `a', a "leak" if you will, then we know that `a' stands alone.
Not that I'm saying its the simplest thing in the world to prove
the non-existance of such an expression in general.
> Partly, I think that your intuition about the common case may be off.
You are probably right there.
> Frankly, I don't much appreciate the tone of this paragraph, or the
> one before it. (In general, I think that the sometime lack of
> courtesy on this list is surprising, given the fact that we are all
> like-minded inviduals working together towards a common goal.) I
> think with a little more care you could have expressed the point that
> there is more to do in the future without demeaning the work done to
> date.
You are right, and I apologise.
I didn't mean to be rude; I guess I'd had an idea in my head how
I would do such a thing, and didn't spend as much time thinking
about yours as I should have.
With some more reflection I see why you have chosen to approach
things the way you have. We do not currently have the tools to
approach the data flow problem while retaining sanity, and your
scheme will work with or without such analysis.
r~