Repository navigation
Warnings on the current main branch #108562
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Aug 28, 2023 On macos it produces a different result:
» ./configure -q && make -s Python/optimizer.c:388:9: warning: variable 'reserved' set but not used [-Wunused-but-set-variable] int reserved = 0; ^ 1 warning generated. Note: Deepfreeze may have added some global objects, so run 'make regen-global-objects' if necessary. ./Modules/readline.c:1257:21: warning: incompatible function pointer types assigning to 'Function *' (aka 'int (*)(const char *, int)') from 'int (void)' [-Wincompatible-function-pointer-types] rl_startup_hook = on_startup_hook; ^ ~~~~~~~~~~~~~~~ ./Modules/readline.c:1259:23: warning: incompatible function pointer types assigning to 'Function *' (aka 'int (*)(const char *, int)') from 'int (void)' [-Wincompatible-function-pointer-types] rl_pre_input_hook = on_pre_input_hook; ^ ~~~~~~~~~~~~~~~~~ 2 warnings generated. Undefined symbols for architecture arm64: "__Py_DECREF_DecRefTotal", referenced from: _test_open_code_hook in _testembed.o _test_unicode_id_init in _testembed.o _Py_DECREF in _testembed.o "__Py_NegativeRefcount", referenced from: _test_open_code_hook in _testembed.o _test_unicode_id_init in _testembed.o _Py_DECREF in _testembed.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Programs/_testembed] Error 1
@sobolevn, in my case the build was successful. I did update of the bugreport in case it wasn't clear.
The libmpdec warning is a false positive due to
-fno-strict-overflow:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113664
libmpdec very much supports strict overflow, so adding
-fstrict=overflowtoLIBMPDEC_CFLAGSshould fix this.@skrah, maybe I miss something, but with
--with-strict-overflowI still see warnings:$ ./configure -q --with-strict-overflow && make -s In function ‘word_to_string’, inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:410:13, inlined from ‘_mpd_to_string’ at ./Modules/_decimal/libmpdec/io.c:611:18: ./Modules/_decimal/libmpdec/io.c:348:40: warning: array subscript 0 is outside array bounds of ‘char[0]’ [-Warray-bounds] 348 | if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d | ~~~~~^~~~~~~~~~~~~~~~~~~~~ ./Modules/_decimal/libmpdec/io.c:355:14: note: in expansion of macro ‘EXTRACT_DIGIT’ 355 | case 19: EXTRACT_DIGIT(s, x, 1000000000000000000ULL, dot); | ^~~~~~~~~~~~~ In function ‘word_to_string’, inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:410:13, inlined from ‘_mpd_to_string’ at ./Modules/_decimal/libmpdec/io.c:607:18: ./Modules/_decimal/libmpdec/io.c:348:40: warning: array subscript 0 is outside array bounds of ‘char[0]’ [-Warray-bounds] 348 | if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d | ~~~~~^~~~~~~~~~~~~~~~~~~~~ ./Modules/_decimal/libmpdec/io.c:355:14: note: in expansion of macro ‘EXTRACT_DIGIT’ 355 | case 19: EXTRACT_DIGIT(s, x, 1000000000000000000ULL, dot); | ^~~~~~~~~~~~~ In function ‘word_to_string’, inlined from ‘coeff_to_string’ at ./Modules/_decimal/libmpdec/io.c:410:13, inlined from ‘_mpd_to_string’ at ./Modules/_decimal/libmpdec/io.c:501:22: ./Modules/_decimal/libmpdec/io.c:348:40: warning: array subscript 0 is outside array bounds of ‘char[0]’ [-Warray-bounds] 348 | if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d | ~~~~~^~~~~~~~~~~~~~~~~~~~~ ./Modules/_decimal/libmpdec/io.c:355:14: note: in expansion of macro ‘EXTRACT_DIGIT’ 355 | case 19: EXTRACT_DIGIT(s, x, 1000000000000000000ULL, dot); | ^~~~~~~~~~~~~ ./Modules/_decimal/libmpdec/io.c:348:40: warning: array subscript 0 is outside array bounds of ‘char[0]’ [-Warray-bounds] 348 | if (s == dot) *s++ = '.'; *s++ = '0' + (char)(x / d); x %= d | ~~~~~^~~~~~~~~~~~~~~~~~~~~ ./Modules/_decimal/libmpdec/io.c:356:14: note: in expansion of macro ‘EXTRACT_DIGIT’ 356 | case 18: EXTRACT_DIGIT(s, x, 100000000000000000ULL, dot); | ^~~~~~~~~~~~~ Checked 110 modules (33 built-in, 76 shared, 1 n/a on linux-x86_64, 0 disabled, 0 missing, 0 failed on import)
PS:
_io_FileIO_close_impl()from the original report is already fixed.
PPS: gcc version was mentioned above:$ gcc --version gcc (Debian 12.2.0-14) 12.2.0
Indeed, that is another false positive (
-Warray-boundsthis time). It is already disabled inmpdecimal-4.0.0.As explained in the linked gcc issue, the exact warning emitted depends on what path the optimizer takes.
The key issue in both cases is that gcc does not like the (correct)if (s == dot)check.If you compile
--with-strict-overflowand apply this patch, it should work:diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c index e7bd6ae..adedde7 100644 --- a/Modules/_decimal/libmpdec/io.c +++ b/Modules/_decimal/libmpdec/io.c @@ -46,6 +46,7 @@ #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && __GNUC__ >= 7 + #pragma GCC diagnostic ignored "-Warray-bounds" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wmisleading-indentation" #endifThanks, that part was backported. See full patch: #114751
- addedbuildThe build process and cross-buildThe build process and cross-build
on Mar 3, 2024 When this PR was merged, LTO buildbots started failing. See for example: https://buildbot.python.org/all/#/builders/29/builds/5844
Reacted by Erlend E. Aasland8 remaining items
Alternative fix: #116346
#116302 works for deadsnakes?
I think so: https://github.com/deadsnakes/python3.13-nightly/actions/runs/8153413773
Thanks for the heads-up, Sergey! Closing as resolved.
@erlend-aasland, warnings in the main are present. I think this issue isn't solved.
Reacted by Erlend E. Aasland@erlend-aasland, this should be fixed if we update bundled mpdecimal to v4. Does it make sense for you?
@erlend-aasland, this should be fixed if we update bundled mpdecimal to v4. Does it make sense for you?
Aren't we trying to unbundle mpdecimal? :)
Yes, but Debian people removed mpdecimal.
UPD: ah, no. v4.0.0 doesn't include #116346
Aren't we trying to unbundle mpdecimal? :)
Right, What's New in Python 3.13 says:
Pending Removal in Python 3.15: The bundled copy of libmpdecimal.
Bug report
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.0a0 (main, Aug 28 2023, 13:54:29) [GCC 12.2.0]
A clear and concise description of the bug:
With
Build is successful, but I see a bunch of warnings:
N.B. second type of warnings (expansions of EXTRACT_DIGIT) seems to be related to the gcc-12. The first I've seen on the Debian Buster (with gcc-10 per default).
Linked PRs