normanr commented on issue #5253: URL: https://github.com/apache/incubator-nuttx/issues/5253#issuecomment-1179798960
The bl602 doesn't have large partitions (it's a tiny micro-controller). The issue comes from the way that the arguments are passed as variadic arguments. The calling site passes them as `long long`, but sprintf only consumes them (with `va_arg`) as `long`. As there are multiple arguments being passed to `vsnprintf` they get "out of alignment" and the address of the labels end up being used for the number values. If I cast the values to `unit32_t` before calling `mount_sprintf` then it works correctly (but I assume any larger than `uint32_t` value would be truncated and not be rendered correctly). Another solution would be to make the conditionals in `usage_entry` based on `CONFIG_LIBC_LONG_LONG` instead of `CONFIG_HAVE_LONG_LONG`. This makes it hard to _detect_ the overflow though. So storing as `long long`, and casting to `long`, and checking that it didn't truncate would be the better. It would be nice if `vsprintf` could consume the `long long` even if `CONFIG_LIBC_LONG_LONG` wasn't defined. One way would be to (assuming the format specifier was for a `long long`) consume a `long`, check that it's zero (debug assert if not), and then consume the remaining `long`? (all assuming that a `long long` can be consumed as two `long`, which entirely depends on how `va_arg` is implemented by the compiler). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org