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

Function inlining #377

Open
MichaelSt98 opened this issue Sep 19, 2024 · 0 comments
Open

Function inlining #377

MichaelSt98 opened this issue Sep 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@MichaelSt98
Copy link
Collaborator

Currently only (single-line) elemental functions are supported.

Currently, this

  elemental function multiply(a, b)
    real(kind=real64) :: multiply
    real(kind=real64), intent(in) :: a, b

    multiply = a * b
  end function multiply

can be inlined correctly. However, something like

  elemental function multiply(a, b)
    real(kind=real64) :: multiply
    real(kind=real64), intent(in) :: a, b
    real(kind=real64) :: temp

    temp = a * b
    multiply = temp
  end function multiply

will be inlined but not correctly! (since only multiply = temp gets inlined).

Further, inlining of member functions is not supported as well as functions that have return value based on a conditional (assignment)

  elemental function multiply_if(a, b)
    real(kind=real64) :: multiply_if
    real(kind=real64), intent(in) :: a, b

    if (a .gt. b) then
      multiply_if = a * b
    else 
      multiply_if = a * a
    endif
  end function multiply_if
@MichaelSt98 MichaelSt98 added bug Something isn't working enhancement New feature or request labels Sep 19, 2024
@MichaelSt98 MichaelSt98 self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant