-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Set func.func arg attributes for procedure designators (#68420)
Currently, if the first usage of a procedure not defined in the file was inside a procedure designator reference (not a call to it), the lowered func.func lacked the argument attributes if any. Fix this by using `CallInterface<T>::declare` too in SignatureBuilder to create a new func.func instead of using custom code. Note: this problem was made worse by the fact that module variables fir.global are currently lowered before the module procedures func.func are created. I will try to fix that in a later patch (the debug location may still be wrong in certain cases) because there is quite some test fallout when changing the order of globals/funcop in the output.
- Loading branch information
1 parent
87b2682
commit 8868431
Showing
5 changed files
with
104 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
flang/test/Lower/HLFIR/procedure-designators-arg-attrs.f90
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
! Ensure that func.func arguments are given the Fortran attributes | ||
! even if their first use is in a procedure designator reference | ||
! and not a call. | ||
|
||
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s | ||
|
||
subroutine test(x) | ||
interface | ||
subroutine foo(x) | ||
integer, optional, target :: x | ||
end subroutine | ||
end interface | ||
integer, optional, target :: x | ||
call takes_proc(foo) | ||
call foo(x) | ||
end subroutine | ||
! CHECK: func.func private @_QPfoo(!fir.ref<i32> {fir.optional, fir.target}) |