The Wayback Machine - https://web.archive.org/web/20210102121044/https://github.com/python/cpython/pull/23999
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40052: Fix alignment issue in PyVectorcall_Function() #23999

Merged
merged 1 commit into from Dec 29, 2020

Conversation

@encukou
Copy link
Member

@encukou encukou commented Dec 29, 2020

In file included from /usr/include/python3.8/Python.h:147:
In file included from /usr/include/python3.8/abstract.h:837:
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 'vectorcallfunc *'
(aka 'struct _object *(**)(struct _object *, struct _object *const *, unsigned long, struct _object *)')
increases required alignment from 1 to 8 [-Werror,-Wcast-align]

    ptr = (vectorcallfunc*)(((char *)callable) + offset);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Co-Authored-By: Andreas Schneider [email protected]
Co-Authored-By: Antoine Pitrou [email protected]

https://bugs.python.org/issue40052

Automerge-Triggered-By: GH:pitrou

In file included from /usr/include/python3.8/Python.h:147:
In file included from /usr/include/python3.8/abstract.h:837:
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 'vectorcallfunc *'
(aka 'struct _object *(**)(struct _object *, struct _object *const *, unsigned long, struct _object *)')
increases required alignment from 1 to 8 [-Werror,-Wcast-align]

    ptr = (vectorcallfunc*)(((char *)callable) + offset);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Co-Authored-By: Andreas Schneider <[email protected]>
Co-Authored-By: Antoine Pitrou <[email protected]>
@encukou
Copy link
Member Author

@encukou encukou commented Dec 29, 2020

This supersedes (and is based on) #19133

@encukou encukou requested review from vstinner and pitrou Dec 29, 2020
@pitrou
pitrou approved these changes Dec 29, 2020
@pitrou
Copy link
Member

@pitrou pitrou commented Dec 29, 2020

@vstinner Is it ok with you?

@vstinner
Copy link
Member

@vstinner vstinner commented Dec 29, 2020

LGTM. memcpy() is a safe solution to solve alignment issues ;-)

Note: PR #19133 looks wrong to me.

@miss-islington miss-islington merged commit 056c082 into python:master Dec 29, 2020
11 checks passed
11 checks passed
Docs
Details
Check for source changes
Details
Check if generated files are up to date
Details
Windows (x86)
Details
Windows (x64)
Details
macOS
Details
Ubuntu
Details
Azure Pipelines PR #20201229.27 succeeded
Details
Travis CI - Pull Request Build Passed
Details
bedevere/issue-number Issue number 40052 found
Details
bedevere/news News entry found in Misc/NEWS.d
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Dec 29, 2020

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒🤖

miss-islington added a commit to miss-islington/cpython that referenced this pull request Dec 29, 2020
…3999)

```
In file included from /usr/include/python3.8/Python.h:147:
In file included from /usr/include/python3.8/abstract.h:837:
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 'vectorcallfunc *'
(aka 'struct _object *(**)(struct _object *, struct _object *const *, unsigned long, struct _object *)')
increases required alignment from 1 to 8 [-Werror,-Wcast-align]

    ptr = (vectorcallfunc*)(((char *)callable) + offset);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
Co-Authored-By: Andreas Schneider <[email protected]>
Co-Authored-By: Antoine Pitrou <[email protected]>
(cherry picked from commit 056c082)

Co-authored-by: Petr Viktorin <[email protected]>
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Dec 29, 2020

GH-24005 is a backport of this pull request to the 3.9 branch.

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Dec 29, 2020

Sorry, @encukou, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 056c08211b402b4dbc1530a9de9d00ad5309909f 3.8

@miss-islington miss-islington self-assigned this Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.