Re: Pointers and Optimization

On 03/31/2011 04:29 PM, Arjen Markus wrote:
If, in my example, you leave out the target attribute to a, c can not
point to it and therefore any optimisation wrt a is okay.

(A clever compiler might be able to see this when c is not pointing to
a, but I doubt it will be able to in more realistic cases with a lot
more code)

Are you saying that in a non-trivial case, a Fortran compiler would be able to optimize this:

real :: a, b, d
real, pointer :: ptr

d = a + 1
... lots of code ...
call foo( ptr )
b = 2 * a

While in C/C++ it would not, because basically everything is "target"?