[OpenMP] Fixed a bug when displaying affinity
authorShilei Tian <tianshilei1992@gmail.com>
Fri, 13 Nov 2020 03:27:22 +0000 (22:27 -0500)
committerShilei Tian <tianshilei1992@gmail.com>
Fri, 13 Nov 2020 03:27:32 +0000 (22:27 -0500)
commit24d0ef0f503f8230f115df049ee0ccd067f0881b
tree7b5ae5479182fb6c00d9eacf3dac3cb47427394d
parent8920ef06a138c46b208fb6471d500261c4b9bacc
[OpenMP] Fixed a bug when displaying affinity

Currently the affinity format string has initial value. When users set
the format via OMP_AFFINITY_FORMAT, it will overwrite the format string. However,
when copying the format, the tailing null is missing. As a result, if the user
format string is shorter than default value, the remaining part in the default
value still makes effort. This bug is not exposed because the test case doesn't
check the end of a string. It only checks whether given output "contains" the
check string.

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D91309
openmp/runtime/src/kmp_safe_c_api.h
openmp/runtime/test/affinity/format/simple_env.c