When we pass an alternate return specifier to a regular (not an asterisk)
dummy argument, flang would throw an internal compiler error of
derefencing a null pointer.
To avoid the ICE, a check was added.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for posting this @unterumarmung! Makes sense to me, but I'd rather defer to somebody with more experience in this area. Let me add a couple more reviewers!
Thanks @unterumarmung for this patch. I have a couple of minor comments.
I have two questions in general. I. can understand if you would like to skip these questions.
-> Are these issues from some internal testsuite?
-> Is this hobby work or official contribution?
| flang/lib/Semantics/check-call.cpp | ||
|---|---|---|
| 700–706 | Isn't this error applicable to DummyProcedure too? | |
| 703 | Nit: Should it be Alternate return label instead of label? | |
| 705 | Nit: Sometimes we prefer not to use early returns. Please wait for another opinion. | |
| flang/lib/Semantics/check-call.cpp | ||
|---|---|---|
| 700–706 | I thought about it too! But there's already an error for this code: fortran
module m
contains
subroutine s3(v)
integer, intent(in) :: v
end subroutine s3
subroutine s(x)
procedure(s3) :: x
end
subroutine s2
call s(*42)
42 stop
end
end module merror: Semantic errors in a.f90
./a.f90:10:9: error: Assumed-type argument may not be forwarded as procedure dummy argument 'x='
call s(*42)
^^^^^^^^^^^Yet, the error message is not totally correct. Should I add the check to DummyProcedure also? | |
| 703 | Nice suggestion, will fix | |
LGTM. Thanks for this patch. In case there are comments from other reviewers, please wait for a day before you submit.
| flang/lib/Semantics/check-call.cpp | ||
|---|---|---|
| 690 | Nit: can't -> cannot | |
Nit: can't -> cannot