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

8326109: GCC 13 reports maybe-uninitialized warnings for jni.cpp with dtrace enabled #2525

Closed
wants to merge 1 commit into from

Conversation

gnu-andrew
Copy link
Member

@gnu-andrew gnu-andrew commented Feb 17, 2024

This is a simple fix that allows newer versions of gcc to build OpenJDK without --disable-warnings-as-errors (i.e. the default)

When dtrace is enabled, the compilation of jni.cpp throws up a number of maybe-uninitialized warnings due to the expansion of the DTRACE_PROBE macros from sdt.hpp e.g.

In file included from /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:88:
In destructor 'DTraceReturnProbeMark_NewStringUTF::~DTraceReturnProbeMark_NewStringUTF()',
    inlined from '_jstring* jni_NewStringUTF(JNIEnv*, const char*)' at /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:2524:1:
/home/andrew/builder/11u-dev/hotspot/variant-server/gensrc/dtracefiles/hotspot_jni.h:4179:1: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
 4179 | DTRACE_PROBE1 (hotspot_jni, NewStringUTF__return, arg1)
      | ^~~~~~~~~~~~~
/localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/utilities/dtrace.hpp:33:24: note: in definition of macro 'DTRACE_ONLY'
   33 | #define DTRACE_ONLY(x) x
      | ^
/localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:2512:1: note: in expansion of macro 'DT_RETURN_MARK_DECL'
 2512 | DT_RETURN_MARK_DECL(NewStringUTF, jstring
      | ^~~~~~~~~~~~~~~~~~~
/localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:2513:23: note: in expansion of macro 'HOTSPOT_JNI_NEWSTRINGUTF_RETURN'
 2513 | , HOTSPOT_JNI_NEWSTRINGUTF_RETURN(_ret_ref));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

I don't see the same on 17u as -Wno-maybe-uninitialized is one of a number of warnings disabled in CompileJvm.gmk. This 11u only patch does the more specific fix of disabling the warning on jni.cpp only and only when dtrace is enabled.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8326109 needs maintainer approval

Issue

  • JDK-8326109: GCC 13 reports maybe-uninitialized warnings for jni.cpp with dtrace enabled (Bug - P4 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/2525/head:pull/2525
$ git checkout pull/2525

Update a local copy of the PR:
$ git checkout pull/2525
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/2525/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2525

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/2525.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 17, 2024

👋 Welcome back andrew! 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 openjdk bot added the rfr Pull request is ready for review label Feb 17, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 17, 2024

Webrevs

@openjdk
Copy link

openjdk bot commented Feb 20, 2024

⚠️ @gnu-andrew This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@gnu-andrew
Copy link
Member Author

Thanks Paul.
/approval request Disables a warning which prevents the build from completing in the default configuration (i.e. without --disable-warnings-as-errors). The warning is triggered by SystemTap headers, not JDK code, when DTrace is enabled.

@openjdk
Copy link

openjdk bot commented Feb 21, 2024

@gnu-andrew
8326109: The approval request has been created successfully.

@openjdk openjdk bot added the approval label Feb 21, 2024
@openjdk
Copy link

openjdk bot commented Feb 21, 2024

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

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

8326109: GCC 13 reports maybe-uninitialized warnings for jni.cpp with dtrace enabled

Reviewed-by: phh

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

  • de3ae6f: 8318468: compiler/tiered/LevelTransitionTest.java fails with -XX:CompileThreshold=100 -XX:TieredStopAtLevel=1
  • 38a60d7: 8318983: Fix comment typo in PKCS12Passwd.java
  • cc88c3c: 8317307: test/jdk/com/sun/jndi/ldap/LdapPoolTimeoutTest.java fails with ConnectException: Connection timed out: no further information
  • ccd4c98: 8319668: Fixup of jar filename typo in BadFactoryTest.sh
  • a5e6577: 8315680: java/lang/ref/ReachabilityFenceTest.java should run with -Xbatch
  • 92cb5eb: 8319456: jdk/jfr/event/gc/collection/TestGCCauseWith[Serial|Parallel].java : GC cause 'GCLocker Initiated GC' not in the valid causes
  • ddc3e41: 8318736: com/sun/jdi/JdwpOnThrowTest.java failed with "transport error 202: bind failed: Address already in use"
  • 6ecf198: 8316001: GC: Make TestArrayAllocatorMallocLimit use createTestJvm
  • f7cd14c: 8307123: Fix deprecation warnings in DPrinter

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 ready Pull request is ready to be integrated and removed approval labels Feb 21, 2024
@gnu-andrew
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 21, 2024

Going to push as commit 382942d.
Since your change was applied there have been 9 commits pushed to the master branch:

  • de3ae6f: 8318468: compiler/tiered/LevelTransitionTest.java fails with -XX:CompileThreshold=100 -XX:TieredStopAtLevel=1
  • 38a60d7: 8318983: Fix comment typo in PKCS12Passwd.java
  • cc88c3c: 8317307: test/jdk/com/sun/jndi/ldap/LdapPoolTimeoutTest.java fails with ConnectException: Connection timed out: no further information
  • ccd4c98: 8319668: Fixup of jar filename typo in BadFactoryTest.sh
  • a5e6577: 8315680: java/lang/ref/ReachabilityFenceTest.java should run with -Xbatch
  • 92cb5eb: 8319456: jdk/jfr/event/gc/collection/TestGCCauseWith[Serial|Parallel].java : GC cause 'GCLocker Initiated GC' not in the valid causes
  • ddc3e41: 8318736: com/sun/jdi/JdwpOnThrowTest.java failed with "transport error 202: bind failed: Address already in use"
  • 6ecf198: 8316001: GC: Make TestArrayAllocatorMallocLimit use createTestJvm
  • f7cd14c: 8307123: Fix deprecation warnings in DPrinter

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 21, 2024
@openjdk openjdk bot closed this Feb 21, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 21, 2024
@openjdk
Copy link

openjdk bot commented Feb 21, 2024

@gnu-andrew Pushed as commit 382942d.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants