[llvm] [OpenMP] Fix stack corruption due to argument mismatch (PR #96386)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 22:28:26 PDT 2024


================
@@ -207,8 +207,7 @@ EXTERN void __tgt_target_data_update_mapper(ident_t *Loc, int64_t DeviceId,
 EXTERN void __tgt_target_data_update_nowait_mapper(
     ident_t *Loc, int64_t DeviceId, int32_t ArgNum, void **ArgsBase,
     void **Args, int64_t *ArgSizes, int64_t *ArgTypes, map_var_info_t *ArgNames,
-    void **ArgMappers, int32_t DepNum, void *DepList, int32_t NoAliasDepNum,
-    void *NoAliasDepList) {
+    void **ArgMappers) {
----------------
sushgokh wrote:

>However, I think we might want to keep them, as I definitely had a patch long time ago that uses them. A better fix would be to modify the front end to emit null value correspondingly.

All the nowait calls, listed below, suffer from the same discrepancy
>__tgt_target_data_begin_nowait_mapper
__tgt_target_data_end_nowait_mapper
__tgt_target_data_update_nowait_mapper

while their counterparts, derived [here](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGOpenMPRuntime.cpp#L10352), only have 9 arguments

So, I am thinking of modifying all the nowait calls while addressing this specific issue. 

@shiltian If you still think that modifying the front-end would be better here, could you tell me what changes are exactly required in the `OffloadingArgs` [here](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGOpenMPRuntime.cpp#L10335) ? I hope this is what you are suggesting.


https://github.com/llvm/llvm-project/pull/96386


More information about the llvm-commits mailing list