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

Internal (nested) procedure support #9

Open
ppenzin opened this issue Jan 18, 2018 · 0 comments
Open

Internal (nested) procedure support #9

ppenzin opened this issue Jan 18, 2018 · 0 comments

Comments

@ppenzin
Copy link
Contributor

ppenzin commented Jan 18, 2018

From F95 standard (this can be inside of a main program or a subprogram):

R210    internal-subprogram-part is contains-stmt
                                      internal-subprogram
                                      [internal-subprogram] ...

Also see Intel Developer Zone example. Basically, you can specify a nested procedure inside another procedure or main program using CONTAINS. A toy example:

$ cat internal.f90 
subroutine s(x)
  integer x
  call s2(x)
  contains
    subroutine s2(y)
      integer y
    end subroutine
end subroutine
$ gfortran -fsyntax-only internal.f90
$ fort -fsyntax-only internal.f90
internal.f90:4:11: error: expected '='
  contains
          ^
internal.f90:5:16: error: expected '='
    subroutine s2(y)
               ^
internal.f90:6:15: error: expected '='
      integer y
              ^
internal.f90:8:1: error: expected 'end program'
end subroutine
^
<unknown>:0: note: to match this 'program'
$ 
@ppenzin ppenzin added this to the 7.0 milestone Jan 18, 2018
@ppenzin ppenzin modified the milestones: 7.0, 8.0 Jan 4, 2019
@ppenzin ppenzin removed this from the 8.0 milestone Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant