Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enable-fstrict-overflow #96821

Open
Open
Labels
buildThe build process and cross-buildperformancePerformance or resource usagetype-featureA feature request or enhancement
@matthiasgoergens

Description

@matthiasgoergens

At the moment we compile releases with-fwrapv which makes the code a bit safer, but disables certain optimizations. From the GCC docs:

This option instructs the compiler to assume that signed arithmetic overflow of addition, subtraction and multiplication wraps around using twos-complement representation. This flag enables some optimizations and disables others.

Myexperiments with running sanitisers seem to suggest that we are nearly already ready for-fno-wrapv (or-fstrict-overflow in general). Doing so could lead to quite a few speedups, but we would need to be more careful with the code we write.

It might be worthwhile to get a few benchmarks.

(To be extra precise, we give-fwrapv for clang and gcc for any build that doesn't get--with-pydebug.)

Pitch

My plan right now is to adapt the build system so that only the modules that need it are build with-fwrapv, and the rest can be build with-fstrict-overflow.

We already have config machinery that can add specificCFLAGS for specific modules only.

Perhaps the whole thing can be gated behind a configure flag, like--with-strict-overflow.

If everything goes well, and this improves performance we can consider adding this functionality to one of the standard optimization options.

We can also work on making more modules-fstrict-overflow safe.

Previous discussion

@markshannon@ericsnowcurrently

Brought up onfaster-cpython/ideas#458 and inspired by#96678

Some previous issues around-fwrapv:

I'm sure there are more.

Progress so far

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

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildperformancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp