RESOLVED FIXED 193441
[JSC] printf-type mishap
https://bugs.webkit.org/show_bug.cgi?id=193441
Summary [JSC] printf-type mishap
Claudio Saavedra
Reported 2019-01-15 03:32:45 PST
[2/1678] Building CXX object Source/JavaScriptCore/shell/CMakeFiles/jsc.dir/__/jsc.cpp.o ../../Source/JavaScriptCore/jsc.cpp: In function ‘int jscmain(int, char**)’: ../../Source/JavaScriptCore/jsc.cpp:2941:16: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=] printf("Memory Footprint:\n Current Footprint: %llu\n Peak Footprint: %llu\n", footprint.current, footprint.peak); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~ ../../Source/JavaScriptCore/jsc.cpp:2941:16: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
Attachments
Patch (1.36 KB, patch)
2019-01-15 03:38 PST, Claudio Saavedra
saam: review-
Claudio Saavedra
Comment 1 2019-01-15 03:38:48 PST
Saam Barati
Comment 2 2019-01-15 14:46:19 PST
Comment on attachment 359151 [details] Patch This doesn't seem to build. Isn't there something for size_t?
Mark Lam
Comment 3 2019-01-15 17:22:06 PST
Comment on attachment 359151 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359151&action=review > Source/JavaScriptCore/jsc.cpp:2941 > - printf("Memory Footprint:\n Current Footprint: %llu\n Peak Footprint: %llu\n", footprint.current, footprint.peak); > + printf("Memory Footprint:\n Current Footprint: %lu\n Peak Footprint: %lu\n", footprint.current, footprint.peak); Saam is correct. You made this work for 32-bit builds but broke 64-bit builds. Instead, you should use size_t like so: printf("Memory Footprint:\n Current Footprint: %zu\n Peak Footprint: %zu\n", static_cast<size_t>(footprint.current), static_cast<size_t>(footprint.peak));
Claudio Saavedra
Comment 4 2019-01-16 00:07:27 PST
Tomas Popela already pushed a fix in https://trac.webkit.org/changeset/239981/webkit.
Radar WebKit Bug Importer
Comment 5 2019-01-16 00:08:31 PST
Note You need to log in before you can comment on or make changes to this bug.