Skip to content

8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type#577

Open
fthevenet wants to merge 3 commits into
openjdk:masterfrom
fthevenet:backport-fthevenet-76a44b3e-master
Open

8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type#577
fthevenet wants to merge 3 commits into
openjdk:masterfrom
fthevenet:backport-fthevenet-76a44b3e-master

Conversation

@fthevenet
Copy link
Copy Markdown
Member

@fthevenet fthevenet commented May 20, 2026

Hi all,

This pull request contains a backport of commit 76a44b3e from the openjdk/jdk repository.

The commit being backported was authored by Jasmine Karthikeyan on 22 Apr 2026 and was reviewed by Daniel Jeliński and Alan Bateman.

This patch is needed in order to build jdk26u with more recent version of gcc (16.1.1+), as it fixes compiler warnings.
Backport is almost clean except for a conflicting copyright year in NetworkInterface.c.

Thanks!



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-8378180 needs maintainer approval

Issue

  • JDK-8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type (Enhancement - P3 - Requested)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 577

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented May 20, 2026

👋 Welcome back fthevenet! A progress list of the required criteria for merging this PR into pr/576 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
Copy Markdown

openjdk Bot commented May 20, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot changed the title Backport 76a44b3e0341a9c59eaff0bfe8884ad104bda8d5 8378180: Compiling OpenJDK with C23 C-Compiler gives warning: initialization discards ‘const’ qualifier from pointer target type May 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 20, 2026

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk Bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels May 20, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented May 20, 2026

Webrevs

@fthevenet
Copy link
Copy Markdown
Member Author

/approval request I'd like to backport this to JDK 25.

Motivation: This patch is needed in order to build jdk26u with more recent version of gcc (16.1.1+), as it fixes compiler warnings.
Backport is almost clean except for a conflicting copyright year in NetworkInterface.c.

The change introduces no behaviour change and, I believe, is low risk.

I have verified that building jdk25u with this patch results in no warning when using gcc 16.1.1 on Fedora 44

@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 21, 2026

@fthevenet
8378180: The approval request has been created successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label May 21, 2026
Copy link
Copy Markdown
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

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

In NetworkInterface.c, you've imported a new macro CHECKED_MALLOC4, which isn't in the original commit.

@fthevenet
Copy link
Copy Markdown
Member Author

In NetworkInterface.c, you've imported a new macro CHECKED_MALLOC4, which isn't in the original commit.

Yes, that indeed looks fishy. thanks for catching that.

@openjdk-notifier openjdk-notifier Bot changed the base branch from pr/576 to master May 26, 2026 10:09
@openjdk-notifier
Copy link
Copy Markdown

The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork:

git checkout backport-fthevenet-76a44b3e-master
git fetch https://git.openjdk.org/jdk25u-dev.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push

@fthevenet
Copy link
Copy Markdown
Member Author

I had indeed missed that the changes to CHECKED_MALLOC4 were introduces by JDK-8362884.
Since this looks reasonable to backport as well, I believe the better thing to do is to port it to 25u first and then re-target this PR on top of it.

@GoeLin
Copy link
Copy Markdown
Member

GoeLin commented May 26, 2026

Hi @fthevenet, please resolve the conflicts.

@fthevenet
Copy link
Copy Markdown
Member Author

fthevenet commented May 26, 2026

Hi @GoeLin

Hi @fthevenet, please resolve the conflicts.

Done, but this cannot be integrated for the moment as this change incorrectly introduce code from a different change.

[...] changes to CHECKED_MALLOC4 were introduces by JDK-8362884.
Since this looks reasonable to backport as well, I believe the better thing to do is to port it to 25u first and then re-target this PR on top of it.

Do you confirm that this is the right approach?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants