Use --cc:vcc --passC:"/analyze", there are some warnings, is these potential bugs?
Debug build:
nim-1.6.2\lib\system\io.nim(825) : warning C6031: Return value ignored: '_setmode'.
nim-1.6.2\lib\system\io.nim(826) : warning C6031: Return value ignored: '_setmode'.
nim-1.6.2\lib\system\io.nim(827) : warning C6031: Return value ignored: '_setmode'.
nim-1.6.2\lib\system\strs_v2.nim(40) : warning C6326: Potential comparison of a constant with another constant.
nim-1.6.2\lib\system\strs_v2.nim(54) : warning C28182: Dereferencing NULL pointer. 'oldP' contains the same NULL value as '*s.p' did. : Lines: 42, 43, 44, 26, 27, 45, 28, 50, 51, 52, 54
nim-1.6.2\lib\system\strs_v2.nim(134) : warning C6011: Dereferencing NULL pointer '*s.p'. : Lines: 129, 132, 26, 27, 28, 133, 135, 134
Release build:
x86\release\stdlib_io.nim.c(303) : warning C6031: Return value ignored: '_setmode'.
x86\release\stdlib_io.nim.c(306) : warning C6031: Return value ignored: '_setmode'.
x86\release\stdlib_io.nim.c(309) : warning C6031: Return value ignored: '_setmode'.
x86\release\stdlib_system.nim.c(1065) : warning C28182: Dereferencing NULL pointer. 'oldP' contains the same NULL value as '*s.p' did. : Lines: 1046, 1047, 1049, 1050, 1051, 1052, 1053, 1054, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1064, 1065
x86\release\stdlib_system.nim.c(1136) : warning C6011: Dereferencing NULL pointer '*s.p'. : Lines: 1114, 1117, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1129, 1130, 1131, 1132, 1133, 1135, 1136
OK, belows are for summary
https://docs.microsoft.com/en-us/cpp/code-quality/c6031?view=msvc-170
https://docs.microsoft.com/en-us/cpp/code-quality/c6326?view=msvc-170
https://docs.microsoft.com/en-us/cpp/code-quality/c28182?view=msvc-170
https://docs.microsoft.com/en-us/cpp/code-quality/c6011?view=msvc-170
Nim generates unreadable C code. C warnings are for human written code.
It makes no sense to apply C warning meant for humans to auto generated C code. Nim already checks that the construct makes sense before passing it to C. It makes no sense to check it in C again. C warnings for Nim code are mostly meaningless. Nim will generate "unsafe" C code because it checked for it safety at the Nim level.
Look look at the code that generates the warnings:
when defined(windows) and not defined(nimscript) and not defined(js):
# work-around C's sucking abstraction:
# BUGFIX: stdin and stdout should be binary files!
proc c_setmode(handle, mode: cint) {.
importc: when defined(bcc): "setmode" else: "_setmode",
header: "<io.h>".}
var
O_BINARY {.importc: "_O_BINARY", header: "<fcntl.h>".}: cint
# we use binary mode on Windows:
c_setmode(c_fileno(stdin), O_BINARY)
c_setmode(c_fileno(stdout), O_BINARY)
c_setmode(c_fileno(stderr), O_BINARY)
It's just a work around a "bug" in windows related to binary input streams.
Look at Nim warnings not C warnings.