Skip to content

Commit 1de41d6

Browse files
cmt0facebook-github-bot
authored andcommitted
Alternative format specifier for %zd (#13187)
Summary: Pull Request resolved: #13187 At runtime this format specifier is not correctly handled by our toolchain's libc implementation. The misformatted string get's passed to strlen and eventually causes an assertion. Reviewed By: lucylq, JacobSzwejbka Differential Revision: D79776266
1 parent 1e3be14 commit 1de41d6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

runtime/executor/method.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ Error Method::resolve_operator(
748748
if (!op_function.ok()) {
749749
ET_LOG(
750750
Error,
751-
"Missing operator: [%zd] %s",
751+
"Missing operator: [%" ET_PRIssize_t "] %s",
752752
static_cast<ssize_t>(op_index),
753753
operator_name);
754754
return op_function.error();

runtime/platform/compiler.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,10 @@
149149
// As of G3 RJ-2024.3 toolchain, zu format specifier is not supported for Xtensa
150150
#if defined(__XTENSA__)
151151
#define ET_PRIsize_t "lu"
152+
#define ET_PRIssize_t "ld"
152153
#else
153154
#define ET_PRIsize_t "zu"
155+
#define ET_PRIssize_t "zd"
154156
#endif
155157

156158
// Whether the compiler supports GNU statement expressions.

0 commit comments

Comments
 (0)