OP-DSL / OP2-Common

OP2: open-source framework for the execution of unstructured grid applications on clusters of GPUs or multi-core CPUs
https://op-dsl.github.io
Other
98 stars 47 forks source link

Fixes seg fault when a nullptr is passed to op_decl_dat with SoA #241

Closed TobyFlynn closed 1 year ago

TobyFlynn commented 1 year ago

A seg fault is occurring when passing a nullptr to op_decl_dat_char when SoA is enabled. This is caused because the data pointer from the function arguments is used instead of the newly allocated data pointer in the op_dat that is created in op_decl_dat_core when converting from AoS to SoA. This pull request changes the AoS to SoA code to use the op_dat's newly allocated/copied data pointer which fixes the issue.

reguly commented 1 year ago

Thanks for spotting this! However, if the user-provided data pointer is nullptr, then there isn't anything to transpose really, so the code should go into the else branch here - can you add that please?

TobyFlynn commented 1 year ago

@reguly yes that makes much more sense, I've just added a commit that does what you suggest