bind_back cannot be compiled with G++ and -fno-delete-null-pointer-checks
- 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
Assessment
This issue has not been assessed yet.