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

GH-44898: [C++] Fix compilation error on GCC 8 #44899

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Dec 2, 2024

Rationale for this change

The span implementation featured a complicated SFINAE construct to enable the span(range...) constructor, which failed compiling on gcc 8.x.

What changes are included in this PR?

Replace this complicated SFINAE with a much simpler one that avoids the recursive span template dependency while keeping the intended semantics.

Are these changes tested?

Yes, by existing tests.

Are there any user-facing changes?

No.

The `span` implementation featured a complicated SFINAE construct to enable the `span(range...)` constructor, which failed on compiling on gcc 8.

Replace this complicated SFINAE with a much simpler one that avoids the recursive `span` template dependency while keeping the intended semantics.
@pitrou
Copy link
Member Author

pitrou commented Dec 2, 2024

@github-actions crossbow submit -g cpp -g r

Copy link

github-actions bot commented Dec 2, 2024

⚠️ GitHub issue #44898 has been automatically assigned in GitHub to PR creator.

Copy link

github-actions bot commented Dec 2, 2024

Revision: 02ca3b5

Submitted crossbow builds: ursacomputing/crossbow @ actions-f791cb99c4

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-cuda-cpp-ubuntu-20.04-cuda-11.2.2 GitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1 GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-clang-sanitizer GitHub Actions
test-r-depsource-bundled Azure
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-minimal-build Azure
test-r-offline-maximal GitHub Actions
test-r-offline-minimal Azure
test-r-rhub-debian-gcc-devel-lto-latest Azure
test-r-rhub-debian-gcc-release-custom-ccache Azure
test-r-rhub-ubuntu-release-latest Azure
test-r-rocker-r-ver-latest Azure
test-r-rstudio-r-base-4.1-opensuse155 Azure
test-r-rstudio-r-base-4.2-focal Azure
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-ubuntu-20.04-cpp GitHub Actions
test-ubuntu-20.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions
test-ubuntu-r-sanitizer GitHub Actions

@pitrou
Copy link
Member Author

pitrou commented Dec 2, 2024

@github-actions crossbow submit wheelcp312*

Copy link

github-actions bot commented Dec 2, 2024

Revision: 02ca3b5

Submitted crossbow builds: ursacomputing/crossbow @ actions-8100cd399e

Task Status
wheel-macos-monterey-cp312-cp312-amd64 GitHub Actions
wheel-macos-monterey-cp312-cp312-arm64 GitHub Actions
wheel-manylinux-2-28-cp312-cp312-amd64 GitHub Actions
wheel-manylinux-2-28-cp312-cp312-arm64 GitHub Actions
wheel-manylinux-2014-cp312-cp312-amd64 GitHub Actions
wheel-manylinux-2014-cp312-cp312-arm64 GitHub Actions
wheel-windows-cp312-amd64 GitHub Actions

@pitrou pitrou requested review from bkietz and felipecrv December 2, 2024 14:31
Copy link
Member

@assignUser assignUser left a comment

Choose a reason for hiding this comment

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

Very nice simplification, thanks for the quick fix!

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Dec 2, 2024
@assignUser
Copy link
Member

The r failures seem unrelated and are also failing in nightlies

@pitrou pitrou requested a review from zanmato1984 December 3, 2024 08:34
@zanmato1984
Copy link
Contributor

Hi @pitrou , could you elaborate a bit more on why GCC 8 complains about the original code and how this change fixes it?

@pitrou
Copy link
Member Author

pitrou commented Dec 3, 2024

Well, I'm not sure. I didn't manage to make sense of the error messages, so instead I opted to trying to remove complexity from the existing constructs until it fixed the issue :)

@zanmato1984
Copy link
Contributor

I guess this kind of compiler version specific error can be hard to interpret (I tried to decode it too but no avail). So I'm good as long as the compiler doesn't complain.

Copy link
Contributor

@zanmato1984 zanmato1984 left a comment

Choose a reason for hiding this comment

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

LGTM.

BTW, since the removed trait was introduced for #40252 (nvcc), did we try this fix on nvcc (from eyeball check it is supposed to work though)? Or shall we ask @vyasr for help verifying?

@pitrou
Copy link
Member Author

pitrou commented Dec 3, 2024

I don't have a nvcc setup ready, but @vyasr might want to take a look indeed.

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Dec 3, 2024
@pitrou pitrou merged commit 9907f37 into apache:main Dec 6, 2024
41 of 42 checks passed
@pitrou pitrou removed the awaiting merge Awaiting merge label Dec 6, 2024
@pitrou pitrou deleted the gh44898-gcc-8-span branch December 6, 2024 09:26
Copy link

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 9907f37.

There were 132 benchmark results with an error:

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 5 possible false positives for unstable benchmarks that are known to sometimes produce them.

@vyasr
Copy link
Contributor

vyasr commented Dec 17, 2024

@pitrou @zanmato1984 I ran the exact same test from #40252 with both the commit right after this PR merged and the latest main, and both compiled under nvcc so I think we're fine. I do still see a number of compiler warnings (including the ones from #40252 but those aren't blockers.

@pitrou
Copy link
Member Author

pitrou commented Dec 17, 2024

Thanks for the feedback @vyasr !

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

Successfully merging this pull request may close these issues.

5 participants