Skip to content

[CUDA] std::clamp doesn't compile with latest clang and gcc #95183

Open
@pateldeev

Description

@pateldeev

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

external/local_config_clang/crosstool/extra_tools/lib/gcc/x86_64-linux-gnu/14.1.0/../../../../include/c++/14.1.0/bits/stl_algo.h:3625:7: error: reference to __host__ function '__glibcxx_assert_fail' in __host__ __device__ function
 3625 |       __glibcxx_assert(!(__hi < __lo));
      |       ^
external/local_config_clang/crosstool/extra_tools/lib/gcc/x86_64-linux-gnu/14.1.0/../../../../include/x86_64-linux-gnu/c++/14.1.0/bits/c++config.h:612:7: note: expanded from macro '__glibcxx_assert'
  612 |         std::__glibcxx_assert_fail();                                   \
      |              ^
quantize.cu.cc:12:13: note: called by 'quantize_z'
   12 |       std::clamp(z, kMinZ, kMaxZ);
      |            ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"cudalibstdc++GNU libstdc++ C++ standard library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions