FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-9566: Fix compiler warnings in peephole.c by jkloth · Pull Request #11011 · python/cpython · GitHub

Repository navigation

bpo-9566: Fix compiler warnings in peephole.c - #11011

Closed
jkloth wants to merge 1 commit into
python:masterfrom
jkloth:issue9566-peephole
Closed

jkloth wants to merge 1 commit into
python:masterfrom
jkloth:issue9566-peephole

Conversation

jkloth commented Dec 7, 2018 •
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

Fixes compiler warnings in peephole.c when compiled for 64-bit.

https://bugs.python.org/issue9566

Copy link
Copy Markdown
Member

This is a duplicate of #10652.

vstinner commented Dec 7, 2018

Copy link
Copy Markdown
Member

@jkloth: Would you be ok to close this PR in favor in mine, PR #10652?

Comment thread Python/peephole.c
assert(PyList_CheckExact(consts));

#if SIZEOF_SIZE_T > 4
if (PyList_GET_SIZE(consts) >= UINT_MAX-1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

My PR uses "if ((size_t)index >= UINT_MAX - 1) {" which shouldn't emit a compiler warning on 32-bit size_t.

Comment thread Python/peephole.c
#if SIZEOF_SIZE_T > 4
/* only replace if it is not too far away */
if (oparg > UINT_MAX) {
h = -1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 ;-)).

Comment thread Python/peephole.c
eval loop's oparg (unsigned int), no rewritting
can be done. */
#if SIZEOF_SIZE_T > 4
if (oparg > UINT_MAX)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It cannot overflow in practice, again, see my PR.

Comment thread Python/peephole.c
assert(i - nops <= INT_MAX);
/* original code offset => new code offset */
blocks[i] = i - nops;
blocks[i] = (int)(i - nops);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

blocks uses unsigned int, not signed int.

Copy link
Copy Markdown

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

vstinner commented Dec 7, 2018

Copy link
Copy Markdown
Member

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 :)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL