Navigation Menu

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

8266168: -Wmaybe-uninitialized happens in check_code.c #3787

wants to merge 1 commit into from


Copy link

@YaSuenag YaSuenag commented Apr 29, 2021

We can see following compiler warning in check_code.c on GCC 11.

/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libverify/check_code.c: In function 'signature_to_fieldtype':
/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libverify/check_code.c:3825:21: warning: 'buffer' may be used uninitialized [-Wmaybe-uninitialized]
 3825 |                     check_and_push(context, buffer, VM_MALLOC_BLK);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ysuenaga/github-forked/jdk/src/java.base/share/native/libverify/check_code.c:4144:13: note: by argument 2 of type 'const void *' to 'check_and_push' declared here
 4144 | static void check_and_push(context_type *context, const void *ptr, int kind)
      |             ^~~~~~~~~~~~~~

It is caused by the change in GCC 11. -Wmaybe-uninitialized diagnoses passing pointers or references to uninitialized memory to functions taking const-qualified arguments.

check_and_push() has const in its argument, and related functions ( free_block() ) does not modify the argument. We can avoid this issue to use calloc(), and it would not be any side-effect at here.


  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed


  • JDK-8266168: -Wmaybe-uninitialized happens in check_code.c



Using git

Checkout this PR locally:
$ git fetch pull/3787/head:pull/3787
$ git checkout pull/3787

Update a local copy of the PR:
$ git checkout pull/3787
$ git pull pull/3787/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3787

View PR using the GUI difftool:
$ git pr show -t 3787

Using diff file

Download this PR as a diff file:

Copy link

bridgekeeper bot commented Apr 29, 2021

👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

Copy link

openjdk bot commented Apr 29, 2021

@YaSuenag The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs label Apr 29, 2021
@YaSuenag YaSuenag marked this pull request as ready for review April 29, 2021 13:05
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 29, 2021
Copy link

mlbridge bot commented Apr 29, 2021


Copy link
Member Author

YaSuenag commented May 6, 2021

Ping: Could you review this PR? We still see this warning with GCC 11.1.

Copy link

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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


I am not aware of any platform where sizeof(char) is not 1, but good to be prepared :)

Copy link

openjdk bot commented May 6, 2021

@YaSuenag This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8266168: -Wmaybe-uninitialized happens in check_code.c

Reviewed-by: stuefe

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 101 new commits pushed to the master branch:

  • 7835cdb: 8265915: adjust state_unloading_cycle compuation order in nmethod::is_unloading
  • 20ad428: 8180568: Refactor javax/crypto shell tests to plain java tests
  • 138d573: 8262392: Update Mesa 3-D Headers to version 21.0.3
  • 9de62a4: 8266505: Cleanup LibraryCallKit::make_unsafe_address()
  • 1885c83: 8266504: Remove leftovers from BarrierSetAssemblerC1
  • 6018336: 8259316: [REDO] C1/C2 compiler support for blackholes
  • f07bb2f: 8250766: javadoc adds redundant spaces when @see program element is wrapped
  • 61bb6ec: 8266453: Shenandoah: Disable write protections before patching nmethod in nmethod_barrier on MacOSX/AArch64
  • a05e8e2: 8266497: Remove unnecessary EMCP liveness indication
  • 6ba911d: 8266498: Make debug ps() call print_stack
  • ... and 91 more:

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 6, 2021
Copy link
Member Author

YaSuenag commented May 6, 2021


@openjdk openjdk bot closed this May 6, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 6, 2021
Copy link

openjdk bot commented May 6, 2021

@YaSuenag Since your change was applied there have been 104 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 0f9852c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@YaSuenag YaSuenag deleted the JDK-8266168 branch May 6, 2021 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
core-libs integrated Pull request has been integrated
2 participants