[Lldb-commits] [lldb] [lldb] Reject mixed typed DWARF binary operands (PR #201288)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 5 08:50:26 PDT 2026
firmiana402 wrote:
Updated the operand compatibility check to avoid rejecting potentially generic DWARF values based only on integer signedness; in other words, the DWARF document says that values of generic types with different signedness can be used in binary operations (e.g., `DW_OP_plus`, `DW_OP_minus`).
DWARF defines the generic type as an address-sized integral type with unspecified signedness, but in practice, the generic type must be treated as having a specific signedness in some cases. For example, the operand of `DW_OP_constu` is treated as unsigned, while the operand of `DW_OP_consts` is treated as signed.
LLDB currently represents expression stack entries as `Value`/`Scalar` and does not explicitly preserve whether a value is the DWARF generic type. In addition, `DW_OP_constu`/`DW_OP_consts` do not use `to_generic` to set the operand to a generic type, but instead set it directly to `uint64`/`int64` (which is non-conforming on 32-bit systems), due to the existing compatibility issue tracked in: https://github.com/llvm/llvm-project/issues/47431.
Because of that, after scalar kind and byte size already match, I updated this patch to treat integer Scalars at least as wide as the target generic type as potentially generic and does not reject them based on signedness alone. This is a compatibility approximation for LLDB's current representation.
The stricter typed-operand behavior is still preserved for non-generic typed integers. For example, smaller base types such as `uint8` vs `int8` are still rejected.
https://github.com/llvm/llvm-project/pull/201288
More information about the lldb-commits
mailing list