Skip to content
Merged
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
4 changes: 2 additions & 2 deletions runtime/platform/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@

// As of G3 RJ-2024.3 toolchain, zu format specifier is not supported for Xtensa
#if defined(__XTENSA__)
#define ET_PRIsize_t "lu"
#define ET_PRIssize_t "ld"
#define ET_PRIsize_t "u"
#define ET_PRIssize_t "d"
Comment on lines +164 to +165
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Using 'u' and 'd' format specifiers assumes size_t/ssize_t are the same size as unsigned int/int on Xtensa. If size_t is larger than unsigned int (e.g., on a 64-bit pointer model with 32-bit int), this will cause truncation and incorrect output. The comment mentions 'zu' is not supported, but typically platforms support either 'zu' or provide alternative size-matching specifiers. Consider verifying that size_t is definitively the same size as unsigned int on Xtensa, or use a cast to unsigned int/int at call sites with appropriate range checking.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@cmt0 this seems like a valid comment - are size_t/ssize_t the same as unsigned int/int on Xtensa 32-bit/64-bit?

#else
#define ET_PRIsize_t "zu"
#define ET_PRIssize_t "zd"
Expand Down
Loading