本帖最后由 pasuka 于 2017-8-7 11:17 编辑
左端赋值包含重复元素的切片这样的写法本身就是不正确的,起码IBM XL和Intel Fortran的用户手册都明确强调这点
传送门1: http://w3.pppl.gov/~hammett/comp/f90tut/f90.tut5.html
Note that a vector subscript with duplicate values cannot appear on the left-hand side of an assignment as it would be ambiguous. Thus,
b( (/ 1, 7, 3, 7 /) ) = (/ 1, 2, 3, 4 /)
is illegal.
传送门2: https://www.ibm.com/support/know ... ectorsubscript.html
An array section with a vector subscript in which two or more elements of the vector subscript have the same value is called a many-one section. Such a section must not:
Appear on the left side of the equal sign in an assignment statement传送门3: https://software.intel.com/en-us/node/678553
An array section with a vector subscript that has two or more elements with the same value is called a many-one array section. For example: REAL A(3, 3), B(4) INTEGER K(4) ! Vector K has repeated values K = (/3, 1, 1, 2/) ! Sets all elements of A to 5.0 A = 5.0 B = A(3, K)The array section A(3,K) consists of the elements: A(3, 3) A(3, 1) A(3, 1) A(3, 2)A many-one section must not appear on the left of the equal sign in an assignment statement, or as an input item in a READ statement.
|