Simple problem on array indices

Salvatore Filippone filippone.salvatore@gmail.com
Thu Jan 9 20:25:00 GMT 2014


Forgot to add, maye it is obvious, maybe not: it is only the LEFT HAND
SIDE that is invalid; repeated indices are perfectly fine in the RHS,
since they just mean copying vector entries multiple times.
Salvatore

On Thu, Jan 9, 2014 at 2:36 PM, Salvatore Filippone
<filippone.salvatore@gmail.com> wrote:
> Adam Hirst wrote:
>>I'd be surprised if weren't rules in the standard about whether array-valued indices are allowed to >alias, because if they are it just sounds like it's allowing all kinds of ambiguous problems like this. >I look forward to what other people in the list have to say, this is interesting.
>>
>>~ Adam
>
> Indeed, vector subscripts with repeated indices are not allowed as
> LHS, hence the code is invalid (for precisely the reasons meniioned by
> Adam) and the compiler is free to do whatever it wants.
> See:
> Metcalf & Reid & Cohen, section 6.13
> Adams et al, F2003 Handbook, section 6.6.4.3  (which should correspond
> to the standard section numbering)
>
> Salvatore Filippone



More information about the Fortran mailing list