-
Notifications
You must be signed in to change notification settings - Fork 20
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
Handle call-by-value parameters #206
base: main
Are you sure you want to change the base?
Conversation
I believe we need to restrict the parameter re-assigning (-> call-by-reference) for more parameters: specifically, bracketed variables I think my change works. The flows-from graph looks correct. @mrd , could I check in with you on this? |
I'm testing like so: module m
implicit none
contains
subroutine double(i, i2)
integer, intent(in) :: i
integer, intent(out) :: i2
print *, "entering double, i =", i
i2 = 2*i
print *, "leaving double, i =", i
end subroutine double
end module m
program overlapping_arg
use m, only: double
implicit none
integer :: j
j = 3
call double(j, j)
print *, "(1) in main, j =", j
call double(j, j)
print *, "(2) in main, j =", j
end program overlapping_arg And running |
I ignored the named parameter feature that Fortran has! Almost finished re-jigging the parsers to properly handle that. (I don't think we look at named parameters in the analysis, so I'm not fixing anything there.) |
Pending while we resolve some potential issues with the |
Analysis.BBlock.perBlock
is where the decision is made on how to create blocks fromcall()
s. Previously, it would check to see if the expression was assignable: either a plain variable, or a subscript. If so, it would "re-assign" them (I'm not completely clear on this part). Now, we treat bracketed plain variables as non-assignable, figuring that they're used as call-by-value.Closes #203 .
TODO
perBlock
: do same for the expression function call (pull the pattern out)