llvm-project
923f7b05 - [flang][cuda] Assign a scalar character function result on the host (#217076)

Commit
60 days ago
[flang][cuda] Assign a scalar character function result on the host (#217076) A managed function result makes an assignment a cuf.data_transfer: function f() result(r) character(len=:), allocatable :: r ! managed under -gpu=mem:managed end function character(len=256) :: c c = f() The rank-0 result r is lowered to a !fir.boxchar<1>, an {address, length} value rather than a reference, so the non-descriptor transfer path has no address to take: 'fir.convert' op invalid type conversion '!fir.boxchar<1>' / '!fir.llvm_ptr<i8>' A fixed-length result does have an address, but the copy is sized by the character kind instead of the length: one character copied, c left unpadded. Managed and unified results are host accessible, so assign a scalar character result on the host and get the padding rules. Array results pass by descriptor and are unaffected.
Author
Parents
Loading