|
| 1 | +From b58f177e3886930d61ef77262b55b64e861e3957 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Mika Laitio < [email protected]> |
| 3 | +Date: Wed, 29 May 2024 10:27:38 -0700 |
| 4 | +Subject: [PATCH] fix the modify of readonly object detected by gcc_14 |
| 5 | +MIME-Version: 1.0 |
| 6 | +Content-Type: text/plain; charset=UTF-8 |
| 7 | +Content-Transfer-Encoding: 8bit |
| 8 | + |
| 9 | +- original patch and bugreports |
| 10 | +1) https://bugs.gentoo.org/918709 |
| 11 | +2) https://github.com/ROCm/rocm_smi_lib/issues/170 |
| 12 | +3) https://github.com/lamikr/rocm_sdk_builder/issues/12 |
| 13 | + |
| 14 | +Fixes following error detected by gcc 14 on Fedora 40: |
| 15 | + |
| 16 | +[ 24%] Building CXX object oam/CMakeFiles/oam.dir/__/src/rocm_smi_utils.cc.o |
| 17 | +In file included from /home/lamikr/own/rocm/src/sdk/rocm_sdk_builder_611/src_projects/rocm_smi_lib/src/rocm_smi_power_mon.cc:52: |
| 18 | +/home/lamikr/own/rocm/src/sdk/rocm_sdk_builder_611/src_projects/rocm_smi_lib/include/rocm_smi/rocm_smi_utils.h: In member function ‘amd::smi::ScopeGuard<lambda>& amd::smi::ScopeGuard<lambda>::operator=(const amd::smi::ScopeGuard<lambda>&)’: |
| 19 | +/home/lamikr/own/rocm/src/sdk/rocm_sdk_builder_611/src_projects/rocm_smi_lib/include/rocm_smi/rocm_smi_utils.h:237:18: error: assignment of member ‘dismiss_’ in read-only object |
| 20 | + 237 | rhs.dismiss_ = true; |
| 21 | + |
| 22 | +Signed-off-by: Mika Laitio < [email protected]> |
| 23 | +--- |
| 24 | + include/rocm_smi/rocm_smi_utils.h | 2 +- |
| 25 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 26 | + |
| 27 | +diff --git a/include/rocm_smi/rocm_smi_utils.h b/include/rocm_smi/rocm_smi_utils.h |
| 28 | +index 40f24ec..0b32148 100755 |
| 29 | +--- a/include/rocm_smi/rocm_smi_utils.h |
| 30 | ++++ b/include/rocm_smi/rocm_smi_utils.h |
| 31 | +@@ -231,7 +231,7 @@ class ScopeGuard { |
| 32 | + __forceinline ~ScopeGuard() { |
| 33 | + if (!dismiss_) release_(); |
| 34 | + } |
| 35 | +- __forceinline ScopeGuard& operator=(const ScopeGuard& rhs) { |
| 36 | ++ __forceinline ScopeGuard& operator=(ScopeGuard& rhs) { |
| 37 | + dismiss_ = rhs.dismiss_; |
| 38 | + release_ = rhs.release_; |
| 39 | + rhs.dismiss_ = true; |
| 40 | +-- |
| 41 | +2.45.1 |
| 42 | + |
0 commit comments