Open edumoot opened 4 months ago
@llvm/issue-subscribers-debuginfo
Author: Yachao Zhu (edumoot)
We will get the same debug information on the pointer variable, with level3 in "1, 2, 3" and level4 in "0, 1, 2, 3 ":
llc -O{level3}--relocation-model=pic case.opt.bc -o case.s
clang -O{level4}case.s -o case.out
I've only looked at a shallow level, but I suspect the optimiser is completely eliminating the "d" variable as it's constant, leaving some of the pointer variables with nothing to point at. AFAIUI we would be able to support this scenario if LLVM were able to use the implicit pointer feature of DWARF, DW_OP_implicit_pointer
. However, that's not currently in a state where it can be used, alas.
If I'm reading the variable information correctly, p_j
is described as a null pointer at the line where the debuggers stop? That might be another defect as the variable is best described as "optimised out" on all lines.
LLVM 18.1.2 (commit 261aae0c) LLVM 17.0.6 (commit, 6009fe18)
Reproduce with:
Results:
The value of pointer p_j is not correct. It should be pointing variable d, with the same value with p_f, instead of p_k.
and GDB shows the similar results.
cat case.c