-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8345627: [REDO] Use gcc12 -ftrivial-auto-var-init=pattern in debug builds #22691
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
Conversation
👋 Welcome back ihse! A progress list of the required criteria for merging this PR into |
@magicus This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 52 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@kimbarrett I'd like your help with this. I'm not really happy with just disabling a warning for a gtest file like this. There is a piece of code in I tried to work around it by creating and assigning to temporary variables, casting etc, but I did not manage to outsmart the compiler. The problematic code is this:
gcc will complain on the first line, the Funnily enough, the flag managed to find another test where there indeed was a possible use before initialization issue. (Even if I guess the variable in question was only written to, never read, so in practice it worked, but it does not look good.) |
Actually, I am not sure we can turn this flag on. I get this:
I could possibly try and override libsleef with |
…patch is getting uglier by the minute...
Also, someone should report a bug to upstream gcc about the |
@magicus This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
Keep the pod bay doors open, please bot. |
@magicus This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@magicus this pull request can not be integrated into git checkout auto-var-init-redo
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Thanks Erik. I'm still waiting for input from @kimbarrett regarding test_tribool.cpp. |
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.
I've run across a couple of internet comments suggesting this option might not
be so great to use, because it can prevent other tools (like valgrind) that
detect uninitialized variables from working. I was expecting that to be an
issue for ubsan, but it seems the uninitialized checking is in MemorySanitizer
(MSan) rather than ubsan.
I think we still want this new option, but maybe there should be some way to
turn it off? Either with a configure argument explicitly, or a way for
enabling something like msan (which we don't currently support) to disable
this warning.
I believe (but haven't verified) that clang has this same option. We should
work to turn it on too. (Doing so might introduce a different set of needed
exclusions.)
Visual Studio provides a similar mechanism, InitAll. There's a discussion of
it in the middle of this blog post:
https://msrc.microsoft.com/blog/2020/05/solving-uninitialized-stack-memory-on-windows/
We should work to turn that on too, again subject potentially another set of
exclusions.
Regarding the tribool exclusion, I'm okay with that. I've figured out how to
deal with it, but am thinking about doing so as part of some additional
tidying up of the tribool stuff.
So this change looks good to me, but I think there is followup work to do.
Let's cross that bridge when we get there. If someone actually notices problems with this flag, then they can file a JBS issue to be able to toggle it. Or if they want msan. /integrate |
Going to push as commit fae37aa.
Your commit was automatically rebased without conflicts. |
Unfortunately, the option to enable this ( |
This is a retry to add
-ftrivial-auto-var-init=pattern
to gcc debug builds. The first attempt was buggy in multiple ways and had to be backed out.This is the description of the original bug report:
gcc12 has added -ftrivial-auto-var-init=, which specifies how automatic variables without an initializer should be initialized. The default choice is "uninitialized", which is the default C/C++ behavior. Alternatives are "pattern" and "zero". For improved debugging, helping to detect uninitialized uses, the "pattern" choice should be used.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22691/head:pull/22691
$ git checkout pull/22691
Update a local copy of the PR:
$ git checkout pull/22691
$ git pull https://git.openjdk.org/jdk.git pull/22691/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22691
View PR using the GUI difftool:
$ git pr show -t 22691
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22691.diff
Using Webrev
Link to Webrev Comment