alternatives to "noalias"?
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Tue Dec 11 19:57:41 AEST 1990
In article <12337 at life.ai.mit.edu> tmb at ai.mit.edu writes:
> In article <12873:Dec1021:09:2890 at kramden.acf.nyu.edu>, brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
[ how to define forall? ]
> There are several useful abstractions:
[ some possibilities ]
But you aren't addressing the real problem. See below.
> |> If the programmer writes
> |> forall(i = 0;i < 100;i++) x[i] = y[i];
> |> then the compiler had better be able to conclude that x and y don't
> |> overlap.
> No, they may overlap.
No! There are vector and parallel machines where the compiler must
generate vastly different code when x and y overlap and when they don't.
Parallel code when x = y is simply *wrong*. It will generate garbage
results. Even if x and y are all filled with the same values, the above
loop may produce new values if the arrays overlap and it is run in
parallel! So any definition along the lines of ``the results must not
depend on the order of execution'' is *not enough*. Two parallel writes
may produce different results from any serial execution of the writes.
*This* is the optimization problem we have to solve. An assertion of
non-aliasing solves the problem, but forall would be a lot more
convenient. How do we define it?
---Dan
More information about the Comp.lang.c
mailing list