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

[flang][debug] Incorrect type for subroutines #108564

Closed
abidh opened this issue Sep 13, 2024 · 2 comments · Fixed by #108605
Closed

[flang][debug] Incorrect type for subroutines #108564

abidh opened this issue Sep 13, 2024 · 2 comments · Fixed by #108605
Assignees

Comments

@abidh
Copy link
Contributor

abidh commented Sep 13, 2024

It seems that flang generates the wrong debug information for type of subroutine. If subroutine has an argument then that is taken as return type. The following example describes the issue:

subroutine sub (r)
  real r
  print *, r
end subroutine

program main
  call sub(3.14)
end program main

This is what GDB shows for the type of the sub. Notice the return type of real.

(gdb) whatis sub
type = real (real)

While it should have been

(gdb) whatis sub
type = void (real)
@abidh abidh self-assigned this Sep 13, 2024
@github-actions github-actions bot added the flang Flang issues not falling into any other category label Sep 13, 2024
@EugeneZelenko EugeneZelenko added debuginfo flang:ir and removed flang Flang issues not falling into any other category labels Sep 13, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 13, 2024

@llvm/issue-subscribers-debuginfo

Author: Abid Qadeer (abidh)

It seems that flang generates the wrong debug information for type of subroutine. If subroutine has an argument then that is taken as return type. The following example describes the issue:
subroutine sub (r)
  real r
  print *, r
end subroutine

program main
  call sub(3.14)
end program main

This is what GDB shows for the type of the sub. Notice the return type of real.

(gdb) whatis sub
type = real (real)

While it should have been

(gdb) whatis sub
type = void (real)

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 13, 2024

@llvm/issue-subscribers-flang-ir

Author: Abid Qadeer (abidh)

It seems that flang generates the wrong debug information for type of subroutine. If subroutine has an argument then that is taken as return type. The following example describes the issue:
subroutine sub (r)
  real r
  print *, r
end subroutine

program main
  call sub(3.14)
end program main

This is what GDB shows for the type of the sub. Notice the return type of real.

(gdb) whatis sub
type = real (real)

While it should have been

(gdb) whatis sub
type = void (real)

abidh added a commit to abidh/llvm-project that referenced this issue Sep 13, 2024
We pass a list of types when creating a subroutine type. The first one
is supposed to be return type and the rest are the argument types. A
subroutine does not have a return type so an argument type could be
confused as a return type. To fix this, if there is no return type,
we generate a null type as a place holder.

Fixes llvm#108564.
abidh added a commit that referenced this issue Sep 17, 2024
We pass a list of types when creating a subroutine type. The first one
is supposed to be return type and the rest are the argument types. A
subroutine does not have a return type so an argument type could be
confused as a return type. To fix this, if there is no return type, we
generate a null type as a place holder.

Fixes #108564.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants