Skip to content

[SYCL] Fix uninitialized fields Coverity hits #15237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 6, 2024
Merged
2 changes: 1 addition & 1 deletion sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class event_impl {
// If this event represents a submission to a
// ur_exp_command_buffer_sync_point_t the sync point for that submission is
// stored here.
ur_exp_command_buffer_sync_point_t MSyncPoint;
ur_exp_command_buffer_sync_point_t MSyncPoint = 0;

// If this event represents a submission to a
// ur_exp_command_buffer_command_handle_t the command-buffer command
Expand Down
4 changes: 3 additions & 1 deletion sycl/source/detail/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ class queue_impl {
MIsInorder(has_property<property::queue::in_order>()),
MDiscardEvents(
has_property<ext::oneapi::property::queue::discard_events>()),
MIsProfilingEnabled(has_property<property::queue::enable_profiling>()) {
MIsProfilingEnabled(has_property<property::queue::enable_profiling>()),
MQueueID{
MNextAvailableQueueID.fetch_add(1, std::memory_order_relaxed)} {
queue_impl_interop(UrQueue);
}

Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,9 +1000,9 @@ const char *Command::getBlockReason() const {
return "A Buffer is locked by the host accessor";
case BlockReason::HostTask:
return "Blocked by host task";
default:
return "Unknown block reason";
}

return "Unknown block reason";
}

void Command::copySubmissionCodeLocation() {
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/scheduler/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ class Command {
/// Used for marking the node during graph traversal.
Marks MMarks;

enum class BlockReason : int { HostAccessor = 0, HostTask };
enum class BlockReason : int { Unset = -1, HostAccessor = 0, HostTask };

// Only have reasonable value while MIsBlockable is true
BlockReason MBlockReason;
BlockReason MBlockReason = BlockReason::Unset;

/// Describes the status of the command.
std::atomic<EnqueueResultT::ResultT> MEnqueueStatus;
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/sycl_mem_obj_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class SYCLMemObjT : public SYCLMemObjI {
// Indicates if memory object should write memory to the host on destruction.
bool MNeedWriteBack;
// Size of memory.
size_t MSizeInBytes;
size_t MSizeInBytes = 0;
// User's pointer passed to constructor.
void *MUserPtr;
// Copy of memory passed by user to constructor.
Expand Down
Loading