[Clang] __builtin_assume_dereferenceable should be constexpr
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Currently `__builtin_assume_dereferenceable` isn't constexpr. I don't think there is a fundamental problem with constant evaluating it though. It should be possible to check whether, from a certain pointer, there are indeed N bytes that can be dereferenced. The compiler has to do that anyways AFAICT, since out of bounds accesses need to be diagnosed during constant evaluation.
Contributor guide
Research direction
Start by locating Clang's implementation and tests for __builtin_assume_dereferenceable, then trace how constant evaluation handles its pointer and byte-count arguments. Done means the builtin can be used in constexpr evaluation while still diagnosing out-of-bounds accesses during constant evaluation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100