https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109487
Bug ID: 109487
Summary: GCC generates redundant DWARF information after
DW_OP_stack_value.
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: hluaw at connect dot ust.hk
Target Milestone: ---
Given the following code:
#include "stdint.h"
struct S0 {
signed a : 25;
const int b;
};
int c, d;
int func_29(uint64_t p1, struct S0 p2, uint16_t p3) {
d = p2.a;
p2.a = 0;
}
int main() {
struct S0 e[] = {{}, {}, {}, {}, {5, 0}, {338810, 4728}};
func_29(c, e[5], 0);
}
Compiled with GCC 12.2.0 and -O1
GCC generates the following DWARF information on p2.
DW_OP_const4u: 338810;
DW_OP_stack_value;
DW_OP_bit_piece: size: 25 offset: 0;
DW_OP_bit_piece: size: 39 offset: 0
But in DWARFv5, DW_OP_stack_value immediately terminate the evaluation of DWARF
expression.
These redundant information are unnecessary and causes trouble in LLDB, making
it unable to display the value of p2.
I know this case somehow is in the "grey area" of the standard, but it is still
a redundant...