Skip to content

read with a vector subscript #952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vdonaldson opened this issue Jul 29, 2021 · 1 comment
Closed

read with a vector subscript #952

vdonaldson opened this issue Jul 29, 2021 · 1 comment
Assignees
Labels
Lowering Issue with lowering, conversion of parse trees into the executable representation FIR

Comments

@vdonaldson
Copy link
Collaborator

See test nag_f95_iso1539/ch9egs.f90

Failure output is not yet implemented IO input item with vector subscripts

  integer a(3), b(3)
  a = [3,2,1]
  b = [4,5,6]
  print*, 'B1: ', b(a) ! conformant; implemented; may be inefficient
  read*, b(a)          ! conformant; not yet implemented
  print*, 'B2: ', b
  print*, 'A1: ', a(a) ! conformant
  read*, a(a)          ! nonconformant (but "allowed")
  print*, 'A2: ', a
  end

Array output with a vector subscript is implemented, but may be doing an unnecessary copy.

Array input with a vector subscript is not implemented; copying in this case would be incorrect.

F18 12.6.3p7 point 1 says: If an array appears as an input/output list item, it is treated as if the elements, if any, were specified in array element order (9.5.3.2). However, no element of that array shall affect the value of any expression in the input-item, nor shall any element appear more than once in a given input-item.

F18 9.5.3.1p2 says: The value of a subscript in an array element shall be within the bounds for its dimension.

These are program requirements, not constraints. So although reading or writing a(a) may be nonconformant, compilers generally "allow" such cases with varying results. These requirements may be a nonissue for implementation. Test ch9egs.f90 has a nonconformant read.

@schweitzpgi schweitzpgi added the Lowering Issue with lowering, conversion of parse trees into the executable representation FIR label Jul 30, 2021
@mleair mleair self-assigned this Aug 16, 2021
@vdonaldson
Copy link
Collaborator Author

Test nag_f95_iso1539/ch9egs.f90 now passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lowering Issue with lowering, conversion of parse trees into the executable representation FIR
Projects
None yet
Development

No branches or pull requests

3 participants