Issue 191025.1: DW_OP_bit_piece offset operand mostly does matter
Section 22.214.171.124, pg 42
The description of DW_OP_bit_piece lists several cases for the preceding
- empty (no location description)
- implicit or stack value
- memory address
For the empty case, the spec explicitly says the bit offset operand
"doesn't matter." For implicit value or stack value, the piece must
use the least significant bits; in these cases, the bit offset again
doesn't matter, although the spec doesn't say so in so many words.
In fact, there is an argument that for the implicit value descriptions
(implicit value, stack value, implicit pointer), the offset operand
could be useful, as a substitute for an explicit shift operation.
PROPOSED REPLACEMENT PARAGRAPH STARTING AT PAGE 42 LINE 25
(For clarity in discussing the changes, I've presented each sentence
individually, and indicated whether the proposal changes it. I feel
that presenting the entire paragraph is helpful, but presenting it in
one lump made it hard to identify the proposed changes.)
Interpretation of the offset depends on the location description.
If the location description is empty, the DW_OP_bit_piece operation
describes a piece consisting of the given number of bits whose values
are undefined, and the offset is ignored.
(reworded, no semantic change)
(third sentence [register case] removed)
If the location is a memory address, the DW_OP_bit_piece operation
describes a sequence of bits relative to the location whose address is
on the top of the DWARF stack using the bit numbering and direction
conventions that are appropriate to the current language on the target
In all other cases, the source of the piece is either a register or an
implicit value description (section 126.96.36.199.4); the offset is from the
least significant bit of the register or implicit value.
2021-03-23 Revised. Previous version: http://dwarfstd.org/issues/191025.1-1.html
2021-04-19 Revised. Previous version: http://dwarfstd.org/issues/191025.1-2.html