Skip to content

[flang][debug] Wrong function signature with CHARACTER arguments. #112886

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

Open
abidh opened this issue Oct 18, 2024 · 3 comments
Open

[flang][debug] Wrong function signature with CHARACTER arguments. #112886

abidh opened this issue Oct 18, 2024 · 3 comments
Assignees

Comments

@abidh
Copy link
Contributor

abidh commented Oct 18, 2024

Consider the following example code.

subroutine foo(str1)
  character(len=5) :: str1
  print *, str1
end subroutine

program test
  integer(8) :: length
  length = 5
  call foo('flang')
end program test

When stopped at line 3 (print *, str1), here is what GDB shows

(gdb) info args
No arguments.
(gdb) ptype foo
type = void (void)
(gdb) info locals
str1 = 'flang'

The debug info is describing str1 as local and not argument. This makes function type wrong too.

This seems to happen because our detection of arguments depends on the memRef of the fir.declare being directly pointing at the BlockArgument. If there is any intermediate nodes like in this case (fir.unboxchar, fir.emboxchar) then this detection fails.

@abidh abidh self-assigned this Oct 18, 2024
@github-actions github-actions bot added the flang Flang issues not falling into any other category label Oct 18, 2024
@abidh
Copy link
Contributor Author

abidh commented Oct 18, 2024

@jeanPerier this is the problem which I mentioned in the comments in #112398 (comment) where having argument number on DeclareOp would save us from pattern matching IR.

@EugeneZelenko EugeneZelenko added debuginfo flang:ir and removed flang Flang issues not falling into any other category labels Oct 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/issue-subscribers-flang-ir

Author: Abid Qadeer (abidh)

Consider the following example code.
subroutine foo(str1)
  character(len=5) :: str1
  print *, str1
end subroutine

program test
  integer(8) :: length
  length = 5
  call foo('flang')
end program test

When stopped at line 3 (print *, str1), here is what GDB shows

(gdb) info args
No arguments.
(gdb) ptype foo
type = void (void)
(gdb) info locals
str1 = 'flang'

The debug info is describing str1 as local and not argument. This makes function type wrong too.

This seems to happen because our detection of arguments depends on the memRef of the fir.declare being directly pointing at the BlockArgument. If there is any intermediate nodes like in this case (fir.unboxchar, fir.emboxchar) then this detection fails.

@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/issue-subscribers-debuginfo

Author: Abid Qadeer (abidh)

Consider the following example code.
subroutine foo(str1)
  character(len=5) :: str1
  print *, str1
end subroutine

program test
  integer(8) :: length
  length = 5
  call foo('flang')
end program test

When stopped at line 3 (print *, str1), here is what GDB shows

(gdb) info args
No arguments.
(gdb) ptype foo
type = void (void)
(gdb) info locals
str1 = 'flang'

The debug info is describing str1 as local and not argument. This makes function type wrong too.

This seems to happen because our detection of arguments depends on the memRef of the fir.declare being directly pointing at the BlockArgument. If there is any intermediate nodes like in this case (fir.unboxchar, fir.emboxchar) then this detection fails.

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

3 participants