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
gh-96821: Add config option --with-strict-overflow
#96823
base: main
Are you sure you want to change the base?
Conversation
-fno-strict-overflow
@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? |
Yes, please add a compiler flag check. FWIW, the autoconf changes themselves look good. |
Misc/NEWS.d/next/Build/2022-09-14-10-38-15.gh-issue-96821.Zk2a9c.rst
Outdated
Show resolved
Hide resolved
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?
Let's discuss this over on gh-96821. |
-fno-strict-overflow
-fstrict-overflow
Misc/NEWS.d/next/Build/2022-09-14-10-38-15.gh-issue-96821.Zk2a9c.rst
Outdated
Show resolved
Hide resolved
…9c.rst Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Let me remove the special handling for |
OK, this is ready to merge as far as I am concerned. @erlend-aasland |
I'll wait for a final thumbs-up from @ericsnowcurrently before merging. |
This seems good to me. However, I don't have the expertise to review the configure script changes. |
@matthiasgoergens, can you please document the new configure option and add a link to those docs in the NEWS entry? See |
Misc/NEWS.d/next/Build/2022-09-14-10-38-15.gh-issue-96821.Zk2a9c.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…9c.rst Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@AA-Turner Thanks for the suggestions! Much appreciated. |
configure.ac
Outdated
[--with-strict-overflow], | ||
[choose between -fstrict-overflow or -fno-strict-overflow (default is no)]),[], | ||
[with_strict_overflow=no]) |
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:
- 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).
- Please add a
AC_MSG_WARN
ifac_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"
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!
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.
Thanks for shepherding this through, @erlend-aasland! |
...and @matthiasgoergens for doing the work, of course. |
(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) |
@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 |
Great, thanks :)
Yes; if we don't, |
Please pick this up, if you can. Thanks! I don't have as much time as I would like these days. |
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 #96739audioop
: gh-96821: Fix undefined behaviour inaudioop.c
#96923_ctypes
: gh-96821: Fix undefined behaviour in_ctypes/cfield.c
#96925-fstrict-overflow
#96821