[all-commits] [llvm/llvm-project] 2cc6b1: [clang][bytecode] Get the right definition before ...
Timm Baeder via All-commits
all-commits at lists.llvm.org
Thu Jun 4 20:25:13 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2cc6b14b11010b8e537a5dfe627159ce96f5a690
https://github.com/llvm/llvm-project/commit/2cc6b14b11010b8e537a5dfe627159ce96f5a690
Author: Timm Baeder <tbaeder at redhat.com>
Date: 2026-06-05 (Fri, 05 Jun 2026)
Changed paths:
M clang/lib/AST/ByteCode/Interp.cpp
Log Message:
-----------
[clang][bytecode] Get the right definition before compiling functions (#201105)
This broke libc++'s
std/ranges/range.adaptors/range.concat/iterator/arithmetic.pass.cpp.
The (reduced via cvise but not enough) function looks like this:
```c++
friend constexpr unsigned
operator-(const __iterator &__x, const __iterator &__y)
{
(void)-(__y - __x);
return 0;
}
```
When evaluating the binary operator for overflow, we will compile the
operator- (_this_ function) to bytecode. At that point,
::isThisDeclarationADefiniton() will return true and ::getDefiniton()
returns the function itself. However, all this is happening while the
function is being instantiated, which means the function doesn't have a
body yet and the bytecode ends up being just a NoRet op. This will of
course later fail.
Fix this by querying the body before trying to compile a function.
Unfortunately I wasn't able to create a reproducer of reasonable size.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list