Simple problem on array indices

Salvatore Filippone filippone.salvatore@gmail.com
Thu Jan 9 13:36:00 GMT 2014


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