Skip to content

Commit 1fd12df

Browse files
committed
rocm_smi_lib gcc 14 build fix
fix the modify of readonly object detected by gcc_14 - original patch and bugreports 1) #12 2) https://bugs.gentoo.org/918709 3) ROCm/rocm_smi_lib#170 [ 24%] Building CXX object oam/CMakeFiles/oam.dir/__/src/rocm_smi_utils.cc.o 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: /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>&)’: /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 237 | rhs.dismiss_ = true; Thank you for Crizle for bug report and link for the fix patch. Signed-off-by: Mika Laitio <[email protected]>
1 parent 16f7d73 commit 1fd12df

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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

Comments
 (0)