Closed nathaniel-daniel closed 1 year ago
Thanks! Do you have an example of the compiler warning?
Yeah, here's the warning. I got this using the mingw64 environment through msys2. The compiler is a gcc port, so I would expect a similar warnings on other platforms as this doesn't seem like a platform specific issue.
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -O3 -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -O3 -DAHOCORASICK_UNICODE= -ID:/Scoop/apps/msys2/2022-09-04/mingw64/include/python3.10 -c src/pyahocorasick.c -o build/temp.mingw_x86_64-3.10/src/pyahocorasick.o
In file included from src/allsources.c:5,
from src/pyahocorasick.c:36:
src/custompickle/load/loadbuffer.c: In function 'loadbuffer_init':
src/custompickle/load/loadbuffer.c:68:30: warning: overflow in conversion from 'long long unsigned int' to 'long int' changes value from '18446744073709551592' to '-24' [-Woverflow]
68 | ret = fseek(input->file, -sizeof(CustompickleFooter), SEEK_END);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc --version
:
gcc.exe (Rev6, Built by MSYS2 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thanks!
This PR fixes a compiler warning created by negating an unsigned integer before casting it to a signed integer. This is fixed by explicitly casting the unsized integer to a
long int
, the type it is implicitly casted to, before negating it.