Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix primitives benchmark code (#812)
The pointer variable is used after releasing memory with `free()`, which is a bug that needs to be addressed. Without this fix, the benchmark code may fail to build or run correctly, resulting in the following error ([link](https://github.com/rapidsai/cucim/actions/runs/12753155354/job/35544254443?pr=811)) ``` In function 'void benchmark::DoNotOptimize(Tp&) [with Tp = char*]', inlined from 'void string_strcpy(benchmark::State&)' at /opt/conda/conda-bld/work/benchmarks/primitives.cpp:110:33: /opt/conda/conda-bld/work/build-release/_deps/deps-googlebenchmark-src/src/../include/benchmark/benchmark.h:322:3: error: pointer used after 'void free(void*)' [-Werror=use-after-free] 322 | asm volatile("" : "+m,r"(value) : : "memory"); | ^~~ ``` It seems that the updated version of GCC is now capable of detecting this potential issue. This commit resolves the issue by ensuring the memory is released only after `benchmark::DoNotOptimize()` is called. This PR handles a build issue related to #811 - #811 Authors: - Gigon Bae (https://github.com/gigony) Approvers: - Bradley Dice (https://github.com/bdice) - https://github.com/jakirkham URL: #812
- Loading branch information