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

HDF5 error handler not reset correctly #187

Closed m-8k closed 3 years ago

m-8k commented 3 years ago

If I understand correctly, the following code snippet intends to store the "automatic error stack traversal function" (hdf5 documentation) and return it to the caller.

https://github.com/OP-DSL/OP2-Common/blob/88bb46ef545df852da3861e8264bbc1d5bcffa97/op2/c/src/externlib/op_hdf5_common.c#L59-L61

However, I think it actually stores the function to the local copy old_func of the parameter, so it's not passed to the caller of H5error_off. This means that the function will not be reset correctly later. The same applies to the second parameter.

I would suggest to fix this by changing the function signature to:

void H5error_off(H5E_auto_t* old_func, void **old_client_data)

Of course, I am happy to submit a pull request.

reguly commented 3 years ago

Yes, that looks like it’s going to be lost. Please do submit the pull request! Thanks!

On 2020. Dec 17., at 14:04, m-8k notifications@github.com wrote:

If I understand correctly, the following code snippet intends to store the "automatic error stack traversal function" (hdf5 documentation https://portal.hdfgroup.org/display/HDF5/H5E_GET_AUTO) and return it to the caller.

https://github.com/OP-DSL/OP2-Common/blob/88bb46ef545df852da3861e8264bbc1d5bcffa97/op2/c/src/externlib/op_hdf5_common.c#L59-L61 https://github.com/OP-DSL/OP2-Common/blob/88bb46ef545df852da3861e8264bbc1d5bcffa97/op2/c/src/externlib/op_hdf5_common.c#L59-L61 However, I think it actually stores the function to the local copy old_func of the parameter, so it's not passed to the caller of H5error_off. This means that the function will not be reset correctly later. The same applies to the second parameter.

I would suggest to fix this by changing the function signature to:

void H5error_off(H5E_auto_t* old_func, void **old_client_data) Of course, I am happy to submit a pull request.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OP-DSL/OP2-Common/issues/187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJWVVOXAMRLC53MVQ2XTN3SVH6UNANCNFSM4U7T7PWA.