GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-96821: Add config option `--with-strict-overflow` by matthiasgoergens · Pull Request #96823 · python/cpython

Conversation

@matthiasgoergens

@matthiasgoergens matthiasgoergens commented Sep 14, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Please see the issue for details.

This PR marks the modules that need -fno-strict-overflow and adds machinery to force -fstrict-overflow, if the users wants that.

As far as is currently known, the three remaining modules that rely on defined integer overflow are fixed by:

  • _struct: gh-96735: Fix undefined behaviour in struct unpacking functions #96739
  • audioop: gh-96821: Fix undefined behaviour in audioop.c #96923
  • _ctypes: gh-96821: Fix undefined behaviour in _ctypes/cfield.c #96925
  • Issue: Enable -fstrict-overflow #96821

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@matthiasgoergens
pythongh-96821: Mark modules that need -fno-strict-overflow
8863e74
@bedevere-bot bedevere-bot added the awaiting review label Sep 14, 2022
@matthiasgoergens matthiasgoergens changed the title gh-96821: Mark modules that need -fno-strict-overflow gh-96821: Mark modules that need -fno-strict-overflow Sep 14, 2022
blurb-it Bot and others added 3 commits September 14, 2022 10:38
@blurb-it
📜🤖 Added by blurb_it.
0598ea9
@matthiasgoergens
Drop fwrapv
50cbb61
@matthiasgoergens
Merge branch 'main' into strict_overflow
f4f3b83
@matthiasgoergens

matthiasgoergens commented Sep 16, 2022

Copy link
Copy Markdown
Contributor Author

@ericsnowcurrently Please have a look.

I think perhaps we should only add the flag when we detect that the compiler supports it? What do you think?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Sep 16, 2022

Copy link
Copy Markdown
Contributor

I think perhaps we should only add the flag when we detect that the compiler supports it? What do you think?

Yes, please add a compiler flag check. FWIW, the autoconf changes themselves look good.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland reviewed Sep 16, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Build/2022-09-14-10-38-15.gh-issue-96821.Zk2a9c.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@matthiasgoergens
Merge branch 'main' into strict_overflow
8015da0
ericsnowcurrently
ericsnowcurrently reviewed Sep 16, 2022
View reviewed changes

@ericsnowcurrently ericsnowcurrently left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This seems okay to me too.

First, though:

How can we verify (now or in the future) that these modules can't use strict overflow or that everything else can?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericsnowcurrently ericsnowcurrently mentioned this pull request Sep 16, 2022
Enable -fstrict-overflow #96821
Open
@ericsnowcurrently

ericsnowcurrently commented Sep 16, 2022

Copy link
Copy Markdown
Member

How can we verify (now or in the future) that these modules can't use strict overflow or that everything else can?

Let's discuss this over on gh-96821.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

matthiasgoergens added 4 commits September 17, 2022 16:30
@matthiasgoergens
Foo
d2a2c82
@matthiasgoergens
fix
25b15bf
@matthiasgoergens
Even I can't remember the f
86d01d6
@matthiasgoergens
Merge remote-tracking branch 'matthias/strict_overflow' into strict_o…
ca2d023
…verflow
@matthiasgoergens matthiasgoergens changed the title gh-96821: Mark modules that need -fno-strict-overflow gh-96821: Machinery for -fstrict-overflow Sep 17, 2022
matthiasgoergens added 5 commits September 17, 2022 16:43
@matthiasgoergens
Merge remote-tracking branch 'origin/main' into strict_overflow
43baf35
@matthiasgoergens
Fix typo
2b6ade9
@matthiasgoergens
Merge branch 'main' into strict_overflow
9d402a8
@matthiasgoergens
News
e5cff7b
@matthiasgoergens
Merge remote-tracking branch 'matthias/strict_overflow' into strict_o…
2118727
…verflow
@CAM-Gerlach CAM-Gerlach added performance Performance or resource usage build The build process and cross-build labels Sep 18, 2022
CAM-Gerlach
CAM-Gerlach reviewed Sep 18, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Build/2022-09-14-10-38-15.gh-issue-96821.Zk2a9c.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

matthiasgoergens and others added 3 commits September 19, 2022 08:04
@matthiasgoergens @CAM-Gerlach
Update Misc/NEWS.d/next/Build/2022-09-14-10-38-15.gh-issue-96821.Zk2a…
a2bb1e9
…9c.rst

Co-authored-by: C.A.M. Gerlach <[email protected]>
@matthiasgoergens
Merge branch 'main' into strict_overflow
89ba064
@matthiasgoergens
Merge branch 'main' into strict_overflow
8d50ae4
erlend-aasland
erlend-aasland reviewed Sep 20, 2022
View reviewed changes
Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread configure.ac Resolved

Uh oh!

There was an error while loading. Please reload this page.

@matthiasgoergens

matthiasgoergens commented Oct 12, 2022

Copy link
Copy Markdown
Contributor Author

@AA-Turner Thanks for the suggestions! Much appreciated.

AA-Turner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland
erlend-aasland previously approved these changes Oct 14, 2022
View reviewed changes
erlend-aasland
erlend-aasland reviewed Oct 14, 2022
View reviewed changes
Comment thread configure.ac Outdated
Comment on lines +2109 to +2111
[--with-strict-overflow],
[choose between -fstrict-overflow or -fno-strict-overflow (default is no)]),[],
[with_strict_overflow=no])

@erlend-aasland erlend-aasland Oct 14, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Sorry to pick on this further. I would like two more changes before merging:

  1. The help message is too vague. I'd like something a la: if 'yes', add -fstrict-overflow to CFLAGS, else add -fno-strict-overflow to CFLAGS (default is no).
  2. Please add a AC_MSG_WARN if ac_cv_cc_supports_fstrict_overflow=no and --with-strict-overflow=yes ("--with-strict-overflow=yes specified, but your compiler does not support the -fstrict-overflow flag"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@matthiasgoergens matthiasgoergens Oct 14, 2022

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Makes sense. Don't worry about picking on this, I'm just glad you care enough to make the effort!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

@erlend-aasland erlend-aasland Oct 18, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks, just ping me when you've made the changes, and I'll get this merged.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericsnowcurrently

ericsnowcurrently commented Oct 18, 2022

Copy link
Copy Markdown
Member

Thanks for shepherding this through, @erlend-aasland!

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericsnowcurrently

ericsnowcurrently commented Oct 18, 2022

Copy link
Copy Markdown
Member

...and @matthiasgoergens for doing the work, of course. 😄

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
erlend-aasland dismissed their stale review October 19, 2022 08:33

Awaiting final changes

@smontanaro

smontanaro commented Nov 22, 2022

Copy link
Copy Markdown
Contributor

(I'm working my way through some PRs which have been approved and are labeled "awaiting merge", hence my seemingly bolt from the blue comment. Why? Read here.)

This work looks to be completed. Can someone merge?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Nov 22, 2022

Copy link
Copy Markdown
Contributor

(I'm working my way through some PRs which have been approved and are labeled "awaiting merge", hence my seemingly bolt from the blue comment. Why? Read here.)

This work looks to be completed. Can someone merge?

I'm awaiting final changes. See #96823 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland erlend-aasland added the DO-NOT-MERGE label Nov 22, 2022
@hauntsaninja
improve help message
9f34477
@hauntsaninja

hauntsaninja commented Jan 20, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@erlend-aasland I was interested in picking this up, so I added the help message change you suggested here #96823 (comment) to the PR

I was looking into adding the warn as well, but I'm not familiar with autoconf. The existing PR looks like it's missing something to me... should we be setting ac_cv_cc_supports_fstrict_overflow in the branches of the AC_COMPILE_IFELSE?

erlend-aasland reacted with hooray emoji matthiasgoergens reacted with heart emoji
All reactions
  • 🎉 1 reaction
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Merge branch 'main' into strict_overflow
7116f84
@erlend-aasland

erlend-aasland commented Jan 20, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@erlend-aasland I was interested in picking this up, so I added the help message change you suggested here #96823 (comment) to the PR

Great, thanks :)

I was looking into adding the warn as well, but I'm not familiar with autoconf. The existing PR looks like it's missing something to me... should we be setting ac_cv_cc_supports_fstrict_overflow in the branches of the AC_COMPILE_IFELSE?

Yes; if we don't, configure will execute this check for every run, even if we're using the -C flag. Also, we must not set STRICT_OVERFLOW_CFLAGS and NO_STRICT_OVERFLOW_CFLAGS inside the AC_CACHE_CHECK; instead, add a AS_VAR_IF after the check, and set those two variables if ac_cv_cc_supports_fstrict_overflow is yes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@matthiasgoergens

matthiasgoergens commented Jan 20, 2023

Copy link
Copy Markdown
Contributor Author

Please pick this up, if you can. Thanks!

I don't have as much time as I would like these days.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hauntsaninja
fix cache, add warning
e526f6e
@hauntsaninja
hauntsaninja requested a review from erlend-aasland January 23, 2023 02:16
@hauntsaninja
use warn, not error
db665ab
@hauntsaninja

hauntsaninja commented Jan 23, 2023

Copy link
Copy Markdown
Contributor

Okay, I think this is ready. I'm not familiar with autoconf, so apologies for any issues!

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Jan 23, 2023

Copy link
Copy Markdown
Contributor

Thanks, Shantanu! It looks good, AFAICS. As an improvement, we could rewrite the logic to only check for the compiler switch if --with-strict-overflow was given.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CAM-Gerlach

CAM-Gerlach commented Mar 3, 2023

Copy link
Copy Markdown
Member

Gentle ping @hauntsaninja @erlend-aasland This came up in discussion and it looks like we're really close to being -fstrict-overflow clean here. Anything else this needs to be merged for 3.12, besides reviewing and merging #96925 also? From a (minimal) docs review perspective, this looks good. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hauntsaninja

hauntsaninja commented Mar 3, 2023

Copy link
Copy Markdown
Contributor

I think this is ready to merge if we need it. Erlend's last comment is a nice to have and I can address it in a follow up PR.

CAM-Gerlach and erlend-aasland reacted with thumbs up emoji CAM-Gerlach reacted with rocket emoji
All reactions
  • 👍 2 reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@matthiasgoergens

matthiasgoergens commented Mar 3, 2023

Copy link
Copy Markdown
Contributor Author

Nice to see this progressing!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hauntsaninja
hauntsaninja merged commit eff9f43 into python:main Mar 4, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Mar 4, 2023
@CAM-Gerlach CAM-Gerlach removed the DO-NOT-MERGE label Mar 5, 2023
@erlend-aasland

erlend-aasland commented Mar 6, 2023

Copy link
Copy Markdown
Contributor

Thanks Shantanu and Matthias!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hugovk pushed a commit to hugovk/cpython that referenced this pull request Mar 6, 2023
@matthiasgoergens @CAM-Gerlach
@erlend-aasland @AA-Turner @hauntsaninja @hugovk
pythongh-96821: Add config option --with-strict-overflow (python#96823
c9931ce
)

Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: Erlend E. Aasland <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Shantanu <[email protected]>
carljm added a commit to carljm/cpython that referenced this pull request Mar 6, 2023
@carljm
Merge branch 'main' into nodeaddict
33dda2a
* main: (21 commits)
  pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in sub interpreters module (python#102472)
  pythongh-95672: Fix versionadded indentation of get_pagesize in test.rst (pythongh-102455)
  pythongh-102416: Do not memoize incorrectly loop rules in the parser (python#102467)
  pythonGH-101362: Optimise PurePath(PurePath(...)) (pythonGH-101667)
  pythonGH-101362: Check pathlib.Path flavour compatibility at import time (pythonGH-101664)
  pythonGH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() (python#101665)
  pythongh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (python#102445)
  pythonGH-102341: Improve the test function for pow (python#102342)
  Fix unused classes in a typing test (pythonGH-102437)
  pythongh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (python#102318)
  pythongh-102356: Add thrashcan macros to filter object dealloc (python#102426)
  Move around example in to_bytes() to avoid confusion (python#101595)
  pythonGH-97546: fix flaky asyncio `test_wait_for_race_condition` test (python#102421)
  pythongh-96821: Add config option `--with-strict-overflow` (python#96823)
  pythongh-101992: update pstlib module documentation (python#102133)
  pythongh-63301: Set exit code when tabnanny CLI exits on error (python#7699)
  pythongh-101863: Fix wrong comments in EUC-KR codec (pythongh-102417)
  pythongh-102302 Micro-optimize `inspect.Parameter.__hash__` (python#102303)
  pythongh-102179: Fix `os.dup2` error reporting for negative fds (python#102180)
  pythongh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (python#101896)
  ...
carljm added a commit to carljm/cpython that referenced this pull request Mar 7, 2023
@carljm
Merge branch 'main' into inlinecomp2
ecb313c
* main: (37 commits)
  pythongh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in sub interpreters module (python#102472)
  pythongh-95672: Fix versionadded indentation of get_pagesize in test.rst (pythongh-102455)
  pythongh-102416: Do not memoize incorrectly loop rules in the parser (python#102467)
  pythonGH-101362: Optimise PurePath(PurePath(...)) (pythonGH-101667)
  pythonGH-101362: Check pathlib.Path flavour compatibility at import time (pythonGH-101664)
  pythonGH-101362: Call join() only when >1 argument supplied to pathlib.PurePath() (python#101665)
  pythongh-102444: Fix minor bugs in `test_typing` highlighted by pyflakes (python#102445)
  pythonGH-102341: Improve the test function for pow (python#102342)
  Fix unused classes in a typing test (pythonGH-102437)
  pythongh-101979: argparse: fix a bug where parentheses in metavar argument of add_argument() were dropped (python#102318)
  pythongh-102356: Add thrashcan macros to filter object dealloc (python#102426)
  Move around example in to_bytes() to avoid confusion (python#101595)
  pythonGH-97546: fix flaky asyncio `test_wait_for_race_condition` test (python#102421)
  pythongh-96821: Add config option `--with-strict-overflow` (python#96823)
  pythongh-101992: update pstlib module documentation (python#102133)
  pythongh-63301: Set exit code when tabnanny CLI exits on error (python#7699)
  pythongh-101863: Fix wrong comments in EUC-KR codec (pythongh-102417)
  pythongh-102302 Micro-optimize `inspect.Parameter.__hash__` (python#102303)
  pythongh-102179: Fix `os.dup2` error reporting for negative fds (python#102180)
  pythongh-101892: Fix `SystemError` when a callable iterator call exhausts the iterator (python#101896)
  ...
@matthiasgoergens matthiasgoergens mentioned this pull request Mar 16, 2023
gh-97588: Fix ctypes structs #97702
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericsnowcurrently ericsnowcurrently ericsnowcurrently left review comments
@AA-Turner AA-Turner AA-Turner left review comments
@CAM-Gerlach CAM-Gerlach CAM-Gerlach left review comments
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@erlend-aasland erlend-aasland

Labels

build The build process and cross-build performance Performance or resource usage

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@matthiasgoergens @erlend-aasland @ericsnowcurrently @smontanaro @hauntsaninja @CAM-Gerlach @AA-Turner @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.