Skip to content

Conversation

@renhiyama
Copy link
Contributor

@renhiyama renhiyama commented Oct 21, 2025

Closes #164403

GCC fails to compile libc currently. This PR fixes this by capturing 'POLY_COEFFS' by reference

@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc label Oct 21, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 21, 2025

@llvm/pr-subscribers-libc

Author: Ren Hiyama (renhiyama)

Changes

Closes #164403


Full diff: https://github.com/llvm/llvm-project/pull/164404.diff

1 Files Affected:

  • (modified) libc/src/math/generic/asinpif16.cpp (+1-1)
diff --git a/libc/src/math/generic/asinpif16.cpp b/libc/src/math/generic/asinpif16.cpp
index aabc0863ba527..395f4c4ebc070 100644
--- a/libc/src/math/generic/asinpif16.cpp
+++ b/libc/src/math/generic/asinpif16.cpp
@@ -77,7 +77,7 @@ LLVM_LIBC_FUNCTION(float16, asinpif16, (float16 x)) {
   };
   // polynomial evaluation using horner's method
   // work only for |x| in [0, 0.5]
-  auto asinpi_polyeval = [](double x) -> double {
+  auto asinpi_polyeval = [&](double x) -> double {
     return x * fputil::polyeval(x * x, POLY_COEFFS[0], POLY_COEFFS[1],
                                 POLY_COEFFS[2], POLY_COEFFS[3], POLY_COEFFS[4],
                                 POLY_COEFFS[5], POLY_COEFFS[6], POLY_COEFFS[7]);

@DavidSpickett
Copy link
Collaborator

DavidSpickett commented Oct 21, 2025

I know you said this in the issue, but the PR description should also say why this is being done. Some people will only see this via the git logs later.

Compiler Explorer link for reference: https://godbolt.org/z/bo44Kz6da

(and otherwise I leave it to the libc team to review)

@renhiyama
Copy link
Contributor Author

I know you said this in the issue, but the PR description should also say why this is being done. Some people will only see this via the git logs later.

Compiler Explorer link for reference: https://godbolt.org/z/bo44Kz6da

(and otherwise I leave it to the libc team to review)

I see, I didn't knew about that - sorry. I have updated the PR description stating that currently GCC cannot build libc, and this PR fixes this by by capturing 'x' by reference. Hopefully this clears the problem!

@lntue lntue changed the title Capture 'x' by reference in asinpi_polyeval lambda [libc] Capture 'POLY_COEFFS' by reference in asinpi_polyeval lambda. Oct 21, 2025
@lntue lntue merged commit fedbb0f into llvm:main Oct 21, 2025
22 checks passed
@github-actions
Copy link

@renhiyama Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@renhiyama renhiyama deleted the patch-1 branch October 21, 2025 15:26
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
…lvm#164404)

Closes llvm#164403

GCC fails to compile libc currently. This PR fixes this by capturing
'POLY_COEFFS' by reference.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…lvm#164404)

Closes llvm#164403

GCC fails to compile libc currently. This PR fixes this by capturing
'POLY_COEFFS' by reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[libc] GCC failing to compile libc

4 participants