Skip to content

Commit 9e19f17

Browse files
eunakim0103mdtoguchi
authored andcommitted
[SYCL] Coverity reported issues (intel#10564)
Coverity reported following two issues and fixed with adding a copy constructor & assignment operator, and removing dead code. 1. Missing user-defined assignment operator - "Copy without assign" rule violation 2. Uninitialized scalar field - class member variable initialization --------- Signed-off-by: Kim, Euna <[email protected]>
1 parent a76a2c5 commit 9e19f17

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

sycl/include/sycl/ext/oneapi/sub_group_mask.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ struct sub_group_mask {
252252
sub_group_mask(const sub_group_mask &rhs)
253253
: Bits(rhs.Bits), bits_num(rhs.bits_num) {}
254254

255+
sub_group_mask &operator=(const sub_group_mask &rhs) = delete;
256+
255257
template <typename Group>
256258
friend std::enable_if_t<std::is_same_v<std::decay_t<Group>, sub_group>,
257259
sub_group_mask>

sycl/include/sycl/types.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,14 @@ template <typename Type, int NumElements> class vec {
751751
// when root cause of API incompatibility will be fixed
752752
#ifdef __SYCL_DEVICE_ONLY__
753753
vec(const vec &Rhs) = default;
754+
vec &operator=(const vec &Rhs) = default;
754755
#else
755756
constexpr vec(const vec &Rhs) : m_Data(Rhs.m_Data) {}
757+
constexpr vec &operator=(const vec &Rhs) = default;
756758
#endif
757759

758760
vec(vec &&Rhs) = default;
759761

760-
vec &operator=(const vec &Rhs) = default;
761-
762762
// W/o this, things like "vec<char,*> = vec<signed char, *>" doesn't work.
763763
template <typename Ty = DataT>
764764
typename std::enable_if_t<!std::is_same_v<Ty, rel_t> &&

sycl/source/detail/queue_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ class queue_impl {
842842
// SYCL app are not the same.
843843
void *MTraceEvent = nullptr;
844844
/// The stream under which the traces are emitted from the queue object
845-
uint8_t MStreamID;
845+
uint8_t MStreamID = 0;
846846
/// The instance ID of the trace event for queue object
847847
uint64_t MInstanceID = 0;
848848

sycl/tools/xpti_helpers/usm_analyzer.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ class USMAnalyzer {
193193
bool TerminateOnError = false;
194194

195195
USMAnalyzer(const USMAnalyzer &obj) = delete;
196+
USMAnalyzer &operator=(const USMAnalyzer &rhs) = delete;
196197

197198
static USMAnalyzer &getInstance() {
198199
static USMAnalyzer s;

0 commit comments

Comments
 (0)