bpo-9566: Fix compiler warnings in peephole.c#11011
bpo-9566: Fix compiler warnings in peephole.c#11011jkloth wants to merge 1 commit intopython:masterfrom
Conversation
|
This is a duplicate of #10652. |
| assert(PyList_CheckExact(consts)); | ||
|
|
||
| #if SIZEOF_SIZE_T > 4 | ||
| if (PyList_GET_SIZE(consts) >= UINT_MAX-1) { |
There was a problem hiding this comment.
My PR uses "if ((size_t)index >= UINT_MAX - 1) {" which shouldn't emit a compiler warning on 32-bit size_t.
| #if SIZEOF_SIZE_T > 4 | ||
| /* only replace if it is not too far away */ | ||
| if (oparg > UINT_MAX) { | ||
| h = -1; |
There was a problem hiding this comment.
I cannot overflow in practice. My PR uses an assertion instead, but also makes sure that the code is smaller than INT_MAX at PyCode_Optimize() entry point (sanity check, it should never occur in pratice, see my comment in my PR ;-)).
| eval loop's oparg (unsigned int), no rewritting | ||
| can be done. */ | ||
| #if SIZEOF_SIZE_T > 4 | ||
| if (oparg > UINT_MAX) |
There was a problem hiding this comment.
It cannot overflow in practice, again, see my PR.
| assert(i - nops <= INT_MAX); | ||
| /* original code offset => new code offset */ | ||
| blocks[i] = i - nops; | ||
| blocks[i] = (int)(i - nops); |
There was a problem hiding this comment.
blocks uses unsigned int, not signed int.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
This PR has multiple issues that I already fixed in my PR. So I close this one, sorry @jkloth. I prefer to focus on a single PR :) |
Fixes compiler warnings in peephole.c when compiled for 64-bit.
https://bugs.python.org/issue9566