Skip to content
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

Wrong printf/scanf format specifiers used for MinGW targets #1413

Closed
veripoolbot opened this issue Apr 2, 2019 · 2 comments
Closed

Wrong printf/scanf format specifiers used for MinGW targets #1413

veripoolbot opened this issue Apr 2, 2019 · 2 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Apr 2, 2019


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.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Apr 2, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-04-02T22:25:24Z


Excellent, thanks for the work & patch.

Fixed in git towards 4.014.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented May 9, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-05-09T01:37:54Z


In 4.014.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.