Skip to content

8355561: [macos] Build failure with Xcode 16.3 #24937

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

Closed
wants to merge 1 commit into from

Conversation

mrserb
Copy link
Member

@mrserb mrserb commented Apr 28, 2025

Multiple similar issues detected in PLATFORM_API_MacOSX_Ports.cpp more info about llvm/llvm-project#62836

jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
127 | AudioDeviceID devices[count];
| ^~~~~
jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: note: read of non-const variable 'count' is not allowed in a constant expression
jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:126:21: note: declared here
126 | int count = size/sizeof(AudioDeviceID);

The usage of VLA has been replaced with malloc/calloc and free, which are already used in this file.

Note that while this patch adds some validation, I am pretty sure it is still possible to crash these code paths if they are executed concurrently. Access to the native pointers being passed around is not properly synchronized.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8355561: [macos] Build failure with Xcode 16.3 (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24937

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 28, 2025

👋 Welcome back serb! 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, 2025

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

8355561: [macos] Build failure with Xcode 16.3

Reviewed-by: kizune, prr

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 192 new commits pushed to 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
Copy link

openjdk bot commented Apr 28, 2025

@mrserb The following label will be automatically applied to this pull request:

  • client

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.

@mrserb
Copy link
Member Author

mrserb commented Apr 28, 2025

/reviewers 2

@openjdk
Copy link

openjdk bot commented Apr 28, 2025

@mrserb
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@@ -229,6 +237,9 @@ INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* mixer
void* PORT_Open(INT32 mixerIndex) {
TRACE1("\n>>PORT_Open (mixerIndex=%d)\n", (int)mixerIndex);
PortMixer *mixer = (PortMixer *)calloc(1, sizeof(PortMixer));
if (!mixer) {
return nullptr;
}
Copy link
Member Author

@mrserb mrserb Apr 28, 2025

Choose a reason for hiding this comment

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

This is a pre-existing bug; the caller code is already prepared to handle null.

->
ret = (jlong) (INT_PTR) PORT_Open(mixerIndex);
-> PORT_Open

@mrserb mrserb marked this pull request as ready for review April 28, 2025 21:51
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 28, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 28, 2025

Webrevs

@mrserb
Copy link
Member Author

mrserb commented Apr 28, 2025

Note that the build is broken not only due to this issue, but also due to another recently introduced problem, which is mentioned in the following link: #24608 (comment).

@TheShermanTanker
Copy link
Contributor

Why not new and delete?

@mrserb
Copy link
Member Author

mrserb commented Apr 30, 2025

Why not new and delete?

In most cases, we allocate raw buffers that are filled by macOS. We could use "std::vector+try/catch" instead, but since malloc/free is already used in this code, I followed the same pattern for consistency.

Copy link
Member

@azuev-java azuev-java left a comment

Choose a reason for hiding this comment

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

Looks good.

@archiecobbs
Copy link
Contributor

Looking forward to getting this fixed so I can build again...

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 6, 2025
@mrserb
Copy link
Member Author

mrserb commented May 7, 2025

/integrate

@openjdk
Copy link

openjdk bot commented May 7, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 7, 2025

@mrserb Pushed as commit 762423d.

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

@mrserb mrserb deleted the sound_2 branch May 7, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants