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

8313889: Fix -Wconversion warnings in foreign benchmarks #15179

Closed
wants to merge 1 commit into from

Conversation

JornVernee
Copy link
Member

@JornVernee JornVernee commented Aug 7, 2023

Fix these -Wconversion warnings in the foreign benchmarks:

./test/micro/org/openjdk/bench/java/lang/foreign/libQSortJNI.c: In function ‘Java_org_openjdk_bench_java_lang_foreign_QSort_jni_1qsort_1optimized’:
./test/micro/org/openjdk/bench/java/lang/foreign/libQSortJNI.c:59:17: warning: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘jsize’ {aka ‘int’} may change the sign of the result [-Wsign-conversion]
   59 |     qsort(ints, length, sizeof(jint), &comparator);
      |                 ^~~~~~
./test/micro/org/openjdk/bench/java/lang/foreign/libQSortJNI.c: In function ‘Java_org_openjdk_bench_java_lang_foreign_QSort_jni_1qsort_1naive’:
./test/micro/org/openjdk/bench/java/lang/foreign/libQSortJNI.c:87:17: warning: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘jsize’ {aka ‘int’} may change the sign of the result [-Wsign-conversion]
   87 |     qsort(carr, length, sizeof(jint), java_cmp);
      |

In this case the issue is that we're converting from a signed type to an unsigned type. So, if the source value is negative, it will be positive after conversion.

Since the source value is a Java array length in both cases, the value can not be negative, so we simply fix this by casting to size_t explicitly.


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

Issue

  • JDK-8313889: Fix -Wconversion warnings in foreign benchmarks (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15179

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 7, 2023

👋 Welcome back jvernee! 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 Aug 7, 2023

@JornVernee 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 Aug 7, 2023
@JornVernee JornVernee marked this pull request as ready for review August 7, 2023 15:08
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 7, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 7, 2023

Webrevs

Copy link
Contributor

@minborg minborg left a comment

Choose a reason for hiding this comment

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

LGTM.

@openjdk
Copy link

openjdk bot commented Aug 8, 2023

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

8313889: Fix -Wconversion warnings in foreign benchmarks

Reviewed-by: pminborg, mcimadamore

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

  • 5c3041c: 8313435: Clean up unused default methods code
  • 8752d49: 8313785: Fix -Wconversion warnings in prims code
  • 41bdcde: 8313875: Use literals instead of static fields in java.util.Math: twoToTheDoubleScaleUp, twoToTheDoubleScaleDown
  • 091e65e: 8313552: Fix -Wconversion warnings in JFR code
  • 7e20952: 8140326: G1: Consider putting regions where evacuation failed into next collection set
  • 28fd7a1: 8311179: Generational ZGC: gc/z/TestSmallHeap.java failed with OutOfMemoryError
  • a1115a7: 8312204: unexpected else with statement causes compiler crash
  • 87a6acb: 8313792: Verify 4th party information in src/jdk.internal.le/share/legal/jline.md
  • 87b08b6: 8307408: Some jdk/sun/tools/jhsdb tests don't pass test JVM args to the debuggee JVM
  • 83edffa: 8309663: test fails "assert(check_alignment(result)) failed: address not aligned: 0x00000008baadbabe"
  • ... and 4 more: https://git.openjdk.org/jdk/compare/bbbfa217a030e90e41c036203f85b764927f4848...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 Aug 8, 2023
@JornVernee
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 8, 2023

Going to push as commit 509f80b.
Since your change was applied there have been 14 commits pushed to the master branch:

  • 5c3041c: 8313435: Clean up unused default methods code
  • 8752d49: 8313785: Fix -Wconversion warnings in prims code
  • 41bdcde: 8313875: Use literals instead of static fields in java.util.Math: twoToTheDoubleScaleUp, twoToTheDoubleScaleDown
  • 091e65e: 8313552: Fix -Wconversion warnings in JFR code
  • 7e20952: 8140326: G1: Consider putting regions where evacuation failed into next collection set
  • 28fd7a1: 8311179: Generational ZGC: gc/z/TestSmallHeap.java failed with OutOfMemoryError
  • a1115a7: 8312204: unexpected else with statement causes compiler crash
  • 87a6acb: 8313792: Verify 4th party information in src/jdk.internal.le/share/legal/jline.md
  • 87b08b6: 8307408: Some jdk/sun/tools/jhsdb tests don't pass test JVM args to the debuggee JVM
  • 83edffa: 8309663: test fails "assert(check_alignment(result)) failed: address not aligned: 0x00000008baadbabe"
  • ... and 4 more: https://git.openjdk.org/jdk/compare/bbbfa217a030e90e41c036203f85b764927f4848...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 8, 2023

@JornVernee Pushed as commit 509f80b.

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

@JornVernee JornVernee deleted the conversion branch August 8, 2023 14:04
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
3 participants