-
Notifications
You must be signed in to change notification settings - Fork 731
Xtensa format specifier #15842
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
Xtensa format specifier #15842
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15842
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit e335d5e with merge base b1e3e28 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Summary: Pull Request resolved: pytorch#15842 Differential Revision: D87159004
46e9981 to
d121251
Compare
Summary: unsigned int seems to be a more correct format specifier than unsigned long for size_t on toolchains that don't support %zu. Differential Revision: D87159004
d121251 to
e335d5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the printf format specifiers for size_t and ssize_t types on the Xtensa platform, changing from "lu"/"ld" (long unsigned/long int) to "u"/"d" (unsigned int/int) format specifiers.
- Changed
ET_PRIsize_tfrom "lu" to "u" for Xtensa - Changed
ET_PRIssize_tfrom "ld" to "d" for Xtensa
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #define ET_PRIsize_t "u" | ||
| #define ET_PRIssize_t "d" |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Differential Revision: D87159004