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

8266173: -Wmaybe-uninitialized happens in jni_util.c #3742

Closed
wants to merge 1 commit into from

Conversation

YaSuenag
Copy link
Member

@YaSuenag YaSuenag commented Apr 28, 2021

We can see compiler warnings in jni_util.c as following on GCC 11. buf should be initialized.

/home/ysuenaga/git-forked/jdk/src/java.base/share/native/libjava/jni_util.c: In function 'newString646_US':
/home/ysuenaga/git-forked/jdk/src/java.base/share/native/libjava/jni_util.c:487:15: warning: 'buf' may be used uninitialized [-Wmaybe-uninitialized]
  487 | result = (*env)->NewString(env, str1, len);
      | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ysuenaga/git-forked/jdk/src/java.base/share/native/libjava/jni_util.c:487:15: note: by argument 2 of type 'const jchar *' {aka 'const short unsigned int *'} to 'struct _jobject *(const struct JNINativeInterface_ **, const jchar *, jsize)' {aka 'struct _jobject *(const struct JNINativeInterface_ **, const short unsigned int *, int)'}
/home/ysuenaga/git-forked/jdk/src/java.base/share/native/libjava/jni_util.c:465:11: note: 'buf' declared here
  465 | jchar buf[512];
      | ^~~

Progress

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

Issue

  • JDK-8266173: -Wmaybe-uninitialized happens in jni_util.c

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3742/head:pull/3742
$ git checkout pull/3742

Update a local copy of the PR:
$ git checkout pull/3742
$ git pull https://git.openjdk.java.net/jdk pull/3742/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3742

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3742.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 28, 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.

@openjdk
Copy link

openjdk bot commented Apr 28, 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 core-libs-dev@openjdk.org label Apr 28, 2021
@YaSuenag YaSuenag marked this pull request as ready for review April 28, 2021 05:55
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 28, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 28, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Seems ok.

@@ -462,7 +462,7 @@ static jstring
newString646_US(JNIEnv *env, const char *str)
{
int len = (int)strlen(str);
jchar buf[512];
jchar buf[512] = {0};
Copy link
Member

Choose a reason for hiding this comment

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

Seems harmless, but a spurious warning - which is to be expected I guess since the flag says "maybe".

@openjdk
Copy link

openjdk bot commented Apr 28, 2021

@YaSuenag 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:

8266173: -Wmaybe-uninitialized happens in jni_util.c

Reviewed-by: dholmes

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

  • 343a4a7: 8185127: Add tests to cover hashCode() method for java supported crypto key types
  • e325a75: 8264593: debug.cpp utilities should be available in product builds.
  • e879f8c: 8265587: IGV: track nodes across matching
  • 164454f: 8265867: thread.hpp defines some enums but no reference
  • 75a2354: 8266028: C2 computes -0.0 for Math.pow(-0.0, 0.5)
  • ca37be1: 8197800: Test java/awt/Focus/NonFocusableWindowTest/NoEventsTest.java fails on Windows
  • cf92693: 8198619: java/awt/Focus/FocusTraversalPolicy/ButtonGroupLayoutTraversal/ButtonGroupLayoutTraversalTest.java fails on mac
  • 2201e11: 8266055: ZGC: ZHeap::print_extended_on() doesn't disable deferred delete
  • ce48f04: 8198617: java/awt/Focus/6382144/EndlessLoopTest.java fails on mac
  • 0438cea: 8136517: [macosx]Test java/awt/Focus/8073453/AWTFocusTransitionTest.java fails on MacOSX
  • ... and 14 more: https://git.openjdk.java.net/jdk/compare/7f4a9f68bfd6fd002f79ac989155550db0bcdd20...master

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 Apr 28, 2021
@YaSuenag
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Apr 29, 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 Apr 29, 2021
@openjdk
Copy link

openjdk bot commented Apr 29, 2021

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

  • 9605aed: 8266251: compiler.inlining.InlineAccessors shouldn't do testing in driver VM
  • 03d4149: 8266255: compiler/eliminateAutobox/TestEliminateBoxInDebugInfo.java uses wrong package name
  • 794cefe: 8241354: ZGC still crashes in containers with NUMA due to get_mempolicy is disabled by default
  • 23180f8: 8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API
  • f75dd80: 8266230: mark hotspot compiler/c2 tests which ignore VM flags
  • 9df6cc7: 8264678: Incomplete comment in build.tools.generatecharacter.GenerateCharacter
  • 73cfc26: 8266232: compiler.c1.TestRangeCheckEliminated should be run in driver mode
  • 3e1b90a: 8266157: Problem list several awt jtreg tests that fail on macOS 11
  • 3f9879f: 8266190: mark hotspot compiler/codecache tests which ignore VM flags
  • d12e01a: 8264472: Add a test group for running CDS tests with -XX:+VerifySharedSpaces
  • ... and 33 more: https://git.openjdk.java.net/jdk/compare/7f4a9f68bfd6fd002f79ac989155550db0bcdd20...master

Your commit was automatically rebased without conflicts.

Pushed as commit 4a9f231.

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

@YaSuenag YaSuenag deleted the JDK-8266173 branch April 29, 2021 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
2 participants