llvm / llvm/llvm-project

bind_back cannot be compiled with G++ and -fno-delete-null-pointer-checks

Open
#202,062 3 comments 0 reactions 0 assignees View on GitHub
build-problem llvm:adt
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

LLVM build failed via g++-13 and `-fno-delete-null-pointer-checks` with the following error:

```
In file included from llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:20,
from llvm-project/llvm/include/llvm/Analysis/SimplifyQuery.h:12,
from llvm-project/llvm/include/llvm/Analysis/InstructionSimplify.h:34,
from llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp:19:
llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h: In instantiation of ‘constexpr auto llvm::bind_back(BindArgsT&& ...) [with auto ConstFn = PatternMatch::match; BindArgsT = {const PatternMatch::is_zero&}]’:
llvm-project/llvm/include/llvm/IR/PatternMatch.h:57:40: required from ‘auto llvm::PatternMatch::match_fn(const Pattern&) [with Val = const llvm::Value; Pattern = is_zero]’
llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp:5258:58: required from here
llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h:334:27: error: non-constant condition for static assertion
334 | static_assert(ConstFn != nullptr);
| ~~~~~~^~~~~~~~
llvm-project/llvm/include/llvm/ADT/STLForwardCompat.h:334:27: error: ‘(llvm::PatternMatch::match != 0)’ is not a constant expression
```

The code above was introduced by [PR-175056](https://github.com/llvm/llvm-project/pull/175056). It seems to be related to _probably_ a GCC bug, see [bug#97913](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97913). So, this is _probably_ not an issue of LLVM, but rather GCC.

Still this situation means LLVM cannot be build with GCC and extra safety flags, such as `-fno-delete-null-pointer-checks`, so I wonder if it'd be a good idea to modify LLVM's source code somehow to work-around the issue?

@AaronBallman @kuhar @kalxr @zwuis @fhahn @zero9178

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.