Skip to content
Merged

fixup #18656

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/executor/tensor_parser_exec_aten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ET_NODISCARD Error validateTensorLayout(
ET_CHECK_OR_RETURN_ERROR(
s_tensor->dim_order()->size() == static_cast<size_t>(dim),
InvalidExternalData,
"Dim order size mismatch. Expected %d, got %zu.",
"Dim order size mismatch. Expected %d, got %u.",
dim,
s_tensor->dim_order()->size());
Comment on lines +135 to 137
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format specifier was changed to %u, but s_tensor->dim_order()->size() is a FlatBuffers vector size type (typically uoffset_t/uint32_t), and %u is not guaranteed to match its underlying type on all platforms (e.g., if uint32_t is unsigned long). To avoid -Wformat/UB and match existing code (see tensor_parser_portable.cpp which uses PRIu32 for FlatBuffers sizes), prefer "%" PRIu32 with an explicit static_cast<uint32_t>(...), or cast to size_t and keep %zu.

Suggested change
"Dim order size mismatch. Expected %d, got %u.",
dim,
s_tensor->dim_order()->size());
"Dim order size mismatch. Expected %d, got %zu.",
dim,
static_cast<size_t>(s_tensor->dim_order()->size()));

Copilot uses AI. Check for mistakes.
for (int i = 0; i < dim; i++) {
Expand Down
Loading