https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089

--- Comment #5 from vehre at gcc dot gnu.org ---
Let's have a look at the standard (F2008, 12.8.2, last sentence):

In the array case, the values of the elements, if any, of the result are
the same as would have been obtained if the scalar function had been applied
separately, in array element order, to corresponding elements of each array
actual argument.

How is this to be interpreted?

This way (pseudo-notation):

(c(i)= plus(c(1), b(i)), i = 1, size(c))

If like above, then the output would be

20, 27, 27, 27, 27

which is what is emitted, when the patch of comment #1 is not applied.

Or like this?

t = c(1)
(c(i) = plus(t, b(i)), i = 1, size(c))

which emits

20, 20, 20, 20, 20

But why is the second version expected, when one formulates this kind of
rhs/lhs dependency? I think the first example is covered by the standard, but I
am not happy with it, because it is not what I would expect, when writing the
code. 

So what do you think?
A third approach could be to add a warning for this kind of lhs/rhs dependency.
How hard would the analysis be?

Reply via email to