On Tue, Jul 10, 2018 at 3:07 PM, Bram Moolenaar <[email protected]> wrote: > > Axel Bender wrote: > >> Compiling gVim 8.1 (latest) on Windows 7 64-bit with MinGW gcc 7.30 64-bit I >> receive the following compiler warning in file undo.c: >> >> gcc -c -Iproto -DWIN32 -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DHAVE_PATHDEF >> -DFEAT_BIG -DHAVE_STDINT_H -DMS_WIN64 -DHAVE_GETTEXT -DHAVE_LOCALE_H >> -DDYNAMIC_GETTEXT -DFEAT_CSCOPE -DFEAT_MBYTE >> -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -pipe -march=x86-64 -Wall >> -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\" -O3 >> -fomit-frame-pointer -freg-struct-return >> -s undo.c -o objx86-64/undo.o >> undo.c: In function 'u_save_cursor': >> undo.c:270:6: warning: assuming signed overflow does not occur when assuming >> that (X - c) > X is always false [-Wstrict-overflow] >> if (top > curbuf->b_ml.ml_line_count >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> || top >= bot >> ^~~~~~~~~~~~~ > > There is no subtraction in this code, thus that is a compiler error. > > Can we please have a C standard without "undefined behavior"? I want my > code to always behave in a defined way. > Maybe the solution would be to change the src/Make_ming.mak to invoke gcc with -O2 (like the src/Makefile does) rather than -O3 as seen above? We had recently (yesterday, or maybe the day before) another warning in perfectly legitimate code (in that case a similar "possible signed overflow" warning for a "for (i = 0; i < something; i++)" construct, which will bail out when i becomes equal to the "something"); that warning was also due to the -O3 switch in a minGW compile.
Best regards, Tony. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
