https://bugs.llvm.org/show_bug.cgi?id=40973
Bug ID: 40973
Summary: Incorrect debug values for parameters that are smaller
than stack slots
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedb...@nondot.org
Reporter: david.stenb...@ericsson.com
CC: jdevliegh...@apple.com, keith.wal...@arm.com,
llvm-bugs@lists.llvm.org,
paul_robin...@playstation.sony.com
Spawned out from D58831.
When compiling the following test case:
extern void bar(short);
void foo(int p0, int p1, int p2, int p3, short p4, short p5) {
bar(p4);
}
using clang from trunk (r355379):
$ clang --target=arm -mbig-endian -O2 -g
we land up with the following debug information for p4 and p5:
0x0000006d: DW_TAG_formal_parameter
DW_AT_name ("p4")
DW_AT_decl_file
("/home/user/upstream/master/stack_dbg_values.c")
DW_AT_decl_line (3)
DW_AT_type (0x0000008e "short")
0x00000078: DW_TAG_formal_parameter
DW_AT_location (DW_OP_breg13 SP+4)
DW_AT_name ("p5")
DW_AT_decl_file
("/home/user/upstream/master/stack_dbg_values.c")
DW_AT_decl_line (3)
DW_AT_type (0x0000008e "short")
I think there are two issues here. For p4, we do not consider truncates when
searching for the FI in SelectionDAGBuilder::EmitFuncArgumentDbgValue(),
meaning that we are left with a $noreg DBG_VALUE, ultimately leading to no
location being emitted for the parameter. For p5, we say that it is located on
the stack at offset 4, but as we are on a big-endian target the two-byte short
parameter is located in the lower two bytes of the 4-byte stack slot, meaning
that the offset should really be 6.
Compare this with the output from GCC (5.4.1):
$ arm-none-eabi-gcc -O1 -g -mbig-endian stack_dbg_values.c -c
0x00000072: DW_TAG_formal_parameter
DW_AT_name ("p4")
DW_AT_decl_file
("/home/user/upstream/master/stack_dbg_values.c")
DW_AT_decl_line (3)
DW_AT_type (0x000000a6 "short int")
DW_AT_location (DW_OP_fbreg +2)
0x0000007f: DW_TAG_formal_parameter
DW_AT_name ("p5")
DW_AT_decl_file
("/home/user/upstream/master/stack_dbg_values.c")
DW_AT_decl_line (3)
DW_AT_type (0x000000a6 "short int")
DW_AT_location (DW_OP_fbreg +6)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs