ROCm / roctracer

ROCm Tracer Callback/Activity Library for Performance tracing AMD GPUs
https://rocm.docs.amd.com/projects/roctracer/en/latest/
Other
64 stars 30 forks source link

reinterpret_cast casts away qualifiers #82

Open Madouura opened 1 year ago

Madouura commented 1 year ago
[ 15%] Built target link_libroctx64.so
/build/source/src/roctx/roctx.cpp:91:25: error: reinterpret_cast from 'const void *' to 'decltype(report_activity.load())' (aka 'int (*)(activity_domain_t, unsigned int, void *)') casts away qualifiers
  report_activity.store(reinterpret_cast<decltype(report_activity.load())>(function),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated when compiling for gfx803.
make[2]: *** [src/CMakeFiles/roctx.dir/build.make:76: src/CMakeFiles/roctx.dir/roctx/roctx.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:195: src/CMakeFiles/roctx.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 21%] Linking CXX static library libutil.a

This can be seemingly fixed by changing reinterpret_cast<decltype(report_activity.load())>(function) to reinterpret_cast<decltype(report_activity.load())>(const_cast<void*>(function)) https://github.com/ROCm-Developer-Tools/roctracer/blob/ac64dff73d32a2f87d022a836b53d0f9598403e0/src/roctx/roctx.cpp#L91