[all-commits] [llvm/llvm-project] d4efbf: [Clang][ExprConst] Handle APValue::LValue in BitCa...

Tommy Chiang via All-commits all-commits at lists.llvm.org
Fri Mar 6 10:06:25 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4efbf10f183657c85bfed31b747f3d8f493ab31
      https://github.com/llvm/llvm-project/commit/d4efbf10f183657c85bfed31b747f3d8f493ab31
  Author: Tommy Chiang <ototot at google.com>
  Date:   2026-03-07 (Sat, 07 Mar 2026)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    A clang/test/CodeGen/bitcast-based-lvalue.c

  Log Message:
  -----------
  [Clang][ExprConst] Handle APValue::LValue in BitCast (#184865)

Instead of marking the branch unreachable, emit an unsupported type
diagnostic and return false when encountering `APValue::LValue` in
`APValueToBufferConverter`.

A good example of this is:
```
long fn() {
  return __builtin_bit_cast(long, (long)&fn);
}
```

Although `&fn` itself is a pointer type, the cast `(long)` converts it
to an integer type, which passes `checkBitCastConstexprEligibilityType`.
Thus, eventually, we see it in Converter, which does not expect an
LValue.

Fixes https://github.com/llvm/llvm-project/issues/44991



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