Wrong printf/scanf format specifiers used for MinGW targets #1413
Labels
area: configure/compiling
Issue involves configuring or compilating Verilator itself
resolution: fixed
Closed; fixed
Author Name: Sergey Kvachonok (@ravenexp)
Original Redmine Issue: 1413 from https://www.veripool.org
Original Assignee: Sergey Kvachonok (@ravenexp)
Modern MinGW C runtime versions (starting from GCC 6)
have switched to C99/C++11 compliant printf/scanf
format specifiers when include is used.
OTOH, when <stdio.h> include is used, MinGW still
defaults to MS formats, but even then it can be
overridden with
#define __USE_MINGW_ANSI_STDIO 1
Source: https://sourceforge.net/p/mingw-w64/wiki2/printf%20and%20scanf%20family/
For GCC 5 MinGW and older, behaved just like <stdio.h>.
verilatedos.h header still assumes that MinGW always uses MS formats,
which breaks printing of 64-bit numbers on 32-bit MinGW GCC 6, 7 and 8.
Compiling verilated.cpp also prints an array of printf format warnings
with modern MinGW compilers for the 32-bit Windows target.
I've attached a patch which makes both old and new MinGW compilers
use the standard printf formats.
Older MinGW versions are just forced to use C99 formats with
the above preprocessor definition.
The text was updated successfully, but these errors were encountered: