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

bug: defining procedure pointer with subroutine not allowed #5757

Closed
kmr-srbh opened this issue Dec 18, 2024 · 1 comment · Fixed by #5770
Closed

bug: defining procedure pointer with subroutine not allowed #5757

kmr-srbh opened this issue Dec 18, 2024 · 1 comment · Fixed by #5770
Labels
asr ASR Related changes bug Something isn't working

Comments

@kmr-srbh
Copy link
Member

Minimal Reproducible Example

program main

   procedure(say_something), pointer :: proc
   proc => say_something

   call proc("Hello from proc!")

contains

   subroutine say_something(message)
      character(len=*),intent(in) :: message
      print *, message
   end subroutine

end program main

Output

(base) saurabh-kumar@Awadh:~/Projects/System/lfortran$ gfortran test.f90 && ./a.out
/usr/bin/ld: warning: /tmp/ccltcx46.o: requires executable stack (because the .note.GNU-stack section is executable)
 Hello from proc!
(base) saurabh-kumar@Awadh:~/Projects/System/lfortran$ lfortran test.f90
semantic error: Procedure type 'say_something' not declared
 --> test.f90:3:4
  |
3 |    procedure(say_something), pointer :: proc
  |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 


Note: Please report unclear, confusing or incorrect messages as bugs at
https://github.com/lfortran/lfortran/issues.
@kmr-srbh kmr-srbh added bug Something isn't working asr ASR Related changes labels Dec 18, 2024
@jinangshah21
Copy link
Contributor

I have a fix. Will push soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
asr ASR Related changes bug Something isn't working
Projects
None yet
2 participants