Skip to content
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

A restricted expression may contain object designators whose base object is a dummy with INTENT(OUT) when they occur in specification inquiries #1599

Open
rofirrim opened this issue May 2, 2022 · 0 comments

Comments

@rofirrim
Copy link

rofirrim commented May 2, 2022

(Sorry again for the wordy title)

flang is rejecting the following code

module my_mod

contains
  subroutine my_sub(str)
    implicit none
    character(len=*), intent(out) :: str

    character(len=1,kind=1), dimension(1:len(str)+1), target :: array_of_char
  end subroutine my_sub

end module my_mod
error: Semantic errors in t.f90
./t.f90:8:65: error: Invalid specification expression: reference to INTENT(OUT) dummy argument 'str'
      character(len=1,kind=1), dimension(1:len(str)+1), target :: array_of_char
                                                                  ^^^^^^^^^^^^^

A quick read to C1010 (§10.1.11 in Fortran 2018 draft) suggests that this should be rejected due to 10.1.11p2 (2), so flang seems correct. However, all other compilers I've been able to test accept this.

Screenshot from 2022-05-02 11-44-51

If we keep reading, there is 10.1.11p2 (7)

Screenshot from 2022-05-02 11-45-39

"Specification inquiry" is defined at 10.1.11p4 and 10.1.11p4 (1) should cover the invocation to LEN.

Screenshot from 2022-05-02 11-49-02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant