jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8289049: x86_32 build fails with GCC 11 due to newString646_US warning

Open shipilev opened this issue 2 years ago • 5 comments

See bug report for reproducer and error message. The warning looks quite superficial, and I initially suspected that it complains about int len = (int)strlen(str) cast of size_t. But what is confusing is nearly the similar code in newStringCp1252 apparently does not produce the warning: https://github.com/openjdk/jdk/blob/f5d1b5bda27c798347ae278cbf69725ed4be895c/src/java.base/share/native/libjava/jni_util.c#L533-L566

I propose we chalk it up to false/odd compiler warning and sync up unproblematic newStringCp1252 and newString646_US implementation to dodge it.

Additional testing:

  • [x] Linux x86_32 build with GCC 11
  • [x] Linux x86_32 tier1 test with GCC 9
  • [x] Linux x86_64 tier1 test with GCC 9

Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8289049: x86_32 build fails with GCC 11 due to newString646_US warning

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9702/head:pull/9702
$ git checkout pull/9702

Update a local copy of the PR:
$ git checkout pull/9702
$ git pull https://git.openjdk.org/jdk pull/9702/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9702

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9702.diff

shipilev avatar Aug 01 '22 11:08 shipilev

:wave: Welcome back shade! 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.

bridgekeeper[bot] avatar Aug 01 '22 12:08 bridgekeeper[bot]

@shipilev 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[bot] avatar Aug 01 '22 12:08 openjdk[bot]

Webrevs

mlbridge[bot] avatar Aug 01 '22 12:08 mlbridge[bot]

Any thoughts?

shipilev avatar Aug 15 '22 11:08 shipilev

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

8289049: x86_32 build fails with GCC 11 due to newString646_US warning

Reviewed-by: alanb, 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 28 new commits pushed to the master branch:

  • f75da2235ab7e33927729fa060ec4d86fdb0240f: 8292395: [testbug] VectorGatherScatterTest.java fails on SVE with -XX:MaxVectorSize=8 after JDK-8288397
  • 802ef38060080254e55621e4c64fa31a6c0b7b18: 8292327: java.io.EOFException in InflaterInputStream after JDK-8281962
  • e61f6fc3940720f6ebc3ef360e25b880729cfa5a: 8292362: java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed on some platforms
  • 0bfb12162f6035559a114176115b91aff6df3b64: 8292051: jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java failed "AssertionError: Expected terminated values: [666] but got: []"
  • 1d9c2f7a6e3e897721ef99af8f383a07148b7c4e: 8292279: (fs) Use try-with-resources to release NativeBuffer
  • a25e1dc53cecc5dd917ac0f76fd86ef1f074adba: 8292285: C2: remove unreachable block after NeverBranch-to-Goto conversion
  • 1ef4e484889c77cccadea44025924b2d010ba2cc: 8273860: Javadoc Deprecated API list should not use italic font for description column
  • 0cc66aeae8cbf2d01be5f5ba38e46f1deb9ec7a6: 8285790: AArch64: Merge C2 NEON and SVE matching rules
  • da477b13661b39e1f48b674f7fd9ea1d26521fc3: 8292509: ProblemList java/lang/invoke/lambda/LogGeneratedClassesTest.java on windows
  • 01b87ba8e2c48ad29c1f4771973ebbe938967448: 8289616: Drop use of Thread.stop in AppContext
  • ... and 18 more: https://git.openjdk.org/jdk/compare/e89abb7d2d902c6e6b3c9953fc6663de10db77b9...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[bot] avatar Aug 15 '22 15:08 openjdk[bot]

Thank you! Any other comments? I'll be integrating it soon otherwise.

shipilev avatar Aug 17 '22 08:08 shipilev

I'm confused. How does adding EnsureCapacity in newString646_US fix the compiler warning mentioned in JBS?

tstuefe avatar Aug 17 '22 08:08 tstuefe

I'm confused. How does adding EnsureCapacity in newString646_US fix the compiler warning mentioned in JBS?

I think this is a bona-fide compiler static analyzer bug. GCC 12 compiles this code fine. So, we have two options: a) disable the warnings for this code block; b) harmonize all code blocks to use the same style, which is also incidentally avoids the false warning. This PR does (b).

shipilev avatar Aug 17 '22 11:08 shipilev

I'm confused. How does adding EnsureCapacity in newString646_US fix the compiler warning mentioned in JBS?

I think this is a bona-fide compiler static analyzer bug. GCC 12 compiles this code fine. So, we have two options: a) disable the warnings for this code block; b) harmonize all code blocks to use the same style, which is also incidentally avoids the false warning. This PR does (b).

Okay, fair enough.

tstuefe avatar Aug 17 '22 11:08 tstuefe

Thanks!

/integrate

shipilev avatar Aug 17 '22 12:08 shipilev

Going to push as commit 0c67fba11f444cc3739f66c8a2d57564b5dcca72. Since your change was applied there have been 30 commits pushed to the master branch:

  • bf7d6d3a0f947ab4a30f27bce6650798289cc7fd: 7132413: [macosx] closed/javax/swing/AbstractButton/5049549/bug5049549.java fails on MacOS
  • e230719ad3cc9e70511d7baa6338bb77cd038139: 8292448: Convert BitMapFragmentTable to ResourceHashtable
  • f75da2235ab7e33927729fa060ec4d86fdb0240f: 8292395: [testbug] VectorGatherScatterTest.java fails on SVE with -XX:MaxVectorSize=8 after JDK-8288397
  • 802ef38060080254e55621e4c64fa31a6c0b7b18: 8292327: java.io.EOFException in InflaterInputStream after JDK-8281962
  • e61f6fc3940720f6ebc3ef360e25b880729cfa5a: 8292362: java/lang/Thread/jni/AttachCurrentThread/AttachTest.java#id1 failed on some platforms
  • 0bfb12162f6035559a114176115b91aff6df3b64: 8292051: jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java failed "AssertionError: Expected terminated values: [666] but got: []"
  • 1d9c2f7a6e3e897721ef99af8f383a07148b7c4e: 8292279: (fs) Use try-with-resources to release NativeBuffer
  • a25e1dc53cecc5dd917ac0f76fd86ef1f074adba: 8292285: C2: remove unreachable block after NeverBranch-to-Goto conversion
  • 1ef4e484889c77cccadea44025924b2d010ba2cc: 8273860: Javadoc Deprecated API list should not use italic font for description column
  • 0cc66aeae8cbf2d01be5f5ba38e46f1deb9ec7a6: 8285790: AArch64: Merge C2 NEON and SVE matching rules
  • ... and 20 more: https://git.openjdk.org/jdk/compare/e89abb7d2d902c6e6b3c9953fc6663de10db77b9...master

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Aug 17 '22 12:08 openjdk[bot]

@shipilev Pushed as commit 0c67fba11f444cc3739f66c8a2d57564b5dcca72.

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

openjdk[bot] avatar Aug 17 '22 12:08 openjdk[bot]