llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Flang][OpenACC] possible memory leak in generated code

Open tblah opened this issue 2 years ago • 2 comments

https://github.com/llvm/llvm-project/blob/d1538c15f9c65a70f4650bd724972536f00f5094/flang/lib/Lower/OpenACC.cpp#L1026 and https://github.com/llvm/llvm-project/blob/d1538c15f9c65a70f4650bd724972536f00f5094/flang/lib/Lower/OpenACC.cpp#L462 both call createTempFromMold on boxed arrays. Which I think will create a heap temporary: https://github.com/llvm/llvm-project/blob/8511b320807085e88a10ae7275c2255da9d0172a/flang/lib/Optimizer/Builder/HLFIRTools.cpp#L1084-L1091

The cleanup value returned from createTempFromMold is ignored in both cases.

tblah avatar Mar 01 '24 11:03 tblah

Both call sites are gone. Private and firstprivate recipes now heap-allocate dynamic-size temporaries in generatePrivateInit (FIROpenACCTypeInterfaces.cpp) and free them in the recipe's destroy region, added in #162702. Reductions got the same destroy region in #164988. acc-private.f90 and acc-reduction.f90 both check for fir.freemem on boxed array recipes. I think this can be closed.

Glitch-On avatar Oct 16 '26 19:10 Glitch-On

Thanks. I'll close.

tblah avatar Oct 18 '26 19:10 tblah