You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[CUDA] std::clamp doesn't compile with latest clang and gcc #95183
Activity
llvmbot commentedon Jun 12, 2024
@llvm/issue-subscribers-clang-frontend
Author: Deev Patel (pateldeev)
Details
Using `std::clamp` fails to compile with clang 18.1.7 and gcc 14.1 libstd. It works with gcc 13.2.Error message is
pinskia commentedon Jul 1, 2024
Same bug as before:
#49727
pinskia commentedon Jul 1, 2024
But it looks like there is some fundamental issue with how cuda handles this.
pinskia commentedon Jul 1, 2024
pytorch/pytorch#127666
AngryLoki commentedon Jun 11, 2025
The same error occurs now with
std::array, as libstdc++-15 adds__glibcxx_requires_subscriptthere too.https://github.com/gcc-mirror/gcc/blob/2f2e51b6596c3796b907c6289d3e631508d8774e/libstdc%2B%2B-v3/include/std/array#L207-L222
This breaks libraries like
composable-kernel- https://bugs.gentoo.org/955623. Note: works with stdlibc++-14 and libc++.Looks like it is possible to undo
__glibcxx_requires_subscriptboth forstd::clampandstd::arrayby adding this:to https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/__clang_hip_runtime_wrapper.h at least before
#include <complex>(which transitively includes<array>). Are there any better solutions?zhaorv commentedon Jun 11, 2025
There is ongoing discussion to fix this in libstdc++: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115740
AngryLoki commentedon Jul 13, 2025
Looks like the issue was addressed in #136133 by @jmmartinez
jmmartinez commentedon Jul 15, 2025
The issue should have been solved by the patch mentioned above.
@pateldeev Could you try with a nightly version of clang to confirm the issue has been solved for you?
Also, a workaround this issue could be to define the macro
_GLIBCXX_ASSERTIONSto0on the command line.jmmartinez commentedon Jul 25, 2025
Since the issue seems to be solved in the latest LLVM version by #136133 I've closed it.