[llvm-bugs] [Bug 43682] New: Invalid DWARF expression for long double on x64
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 15 10:08:12 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43682
Bug ID: 43682
Summary: Invalid DWARF expression for long double on x64
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: brettw at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 22675
--> https://bugs.llvm.org/attachment.cgi?id=22675&action=edit
Repro case
I was experimenting with long doubles on x64 (80 bits which force x87
instructions). Clang seems to generate corrupt DWARF expressions. For this:
long double ld = 2.38;
ld += argc;
(see attached source file), it produces this DWARF entry:
DW_TAG_variable
DW_AT_location (0x0000005a
[0x0000000000201714, 0x0000000000201722): DW_OP_constu
0x9851eb851eb85000, DW_OP_stack_value, DW_OP_piece 0x8, DW_OP_constu 0x4000,
DW_OP_stack_value, DW_OP_bit_piece 0x10 0x40, DW_OP_stack_value)
DW_AT_name ("ld")
DW_AT_decl_file ("float.cc")
DW_AT_decl_line (4)
DW_AT_type (0x00000090 "long double")
This expression makes no sense. It seems to be three different ones
concatenated together, as the three DW_OP_stack_value instructions should each
indicate the end of the expression.
Additionally this variable should have two distinct values while these symbols
only indicate one.
In that expression, I used "argc" to force it to not optimize the math.
Removing that generates a reasonable looking constant value:
DW_TAG_variable
DW_AT_const_value (<0x0a> 00 50 b8 1e 85 eb 51 98 00 40 )
DW_AT_name ("ld")
DW_AT_decl_file ("float.cc")
DW_AT_decl_line (4)
DW_AT_type (0x00000097 "long double")
If the type is changed to a "double", the DWARF is reasonable, showing a
constant value and then the result of the math operation in a register:
DW_TAG_variable
DW_AT_location (0x00000046
[0x0000000000201711, 0x000000000020171d): DW_OP_constu
0x40030a3d70a3d70a, DW_OP_stack_value
[0x000000000020171d, 0x0000000000201729): DW_OP_reg17 XMM0)
DW_AT_name ("ld")
DW_AT_decl_file ("float.cc")
DW_AT_decl_line (4)
DW_AT_type (0x0000002a "double")
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191015/dfff0a0b/attachment.html>
More information about the llvm-bugs
mailing list