From b94f9fe07183e1b39286e960df78617a96c31e4e Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Fri, 29 Aug 2025 22:23:45 -0500 Subject: [PATCH] runners: Fixed 64-bit overflow when size_t < bench_io_t Long story short: %zd != %jd! This was a simple oversight when writing the bench printing code, and easy to miss on x86_64 and other modern PCs, but the mistake becomes very apparent when trying to bench under qemu in thumb mode! --- runners/bench_runner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runners/bench_runner.c b/runners/bench_runner.c index a9da90a7..7805e333 100644 --- a/runners/bench_runner.c +++ b/runners/bench_runner.c @@ -659,7 +659,7 @@ void bench_stop(const char *m) { for (size_t i = 0; i < bench_record_count; i++) { if (strcmp(bench_records[i].m, m) == 0) { // print results - printf("benched %s %zd %"PRIu64" %"PRIu64" %"PRIu64"\n", + printf("benched %s %jd %"PRIu64" %"PRIu64" %"PRIu64"\n", bench_records[i].m, bench_records[i].n, readed - bench_records[i].last_readed, @@ -684,7 +684,7 @@ void bench_stop(const char *m) { void bench_result(const char *m, uintmax_t n, uintmax_t result) { // we just print these directly - printf("benched %s %zd %"PRIu64"\n", + printf("benched %s %jd %"PRIu64"\n", m, n, result); @@ -692,7 +692,7 @@ void bench_result(const char *m, uintmax_t n, uintmax_t result) { void bench_fresult(const char *m, uintmax_t n, double result) { // we just print these directly - printf("benched %s %zd %.6f\n", + printf("benched %s %jd %.6f\n", m, n, result);