Assertion `(!CombinedExpr || CombinedExpr->isValid()) && "Combined debug expression is invalid"' failed
| Bugzilla Link | 45181 |
| Resolution | FIXED |
| Resolved on | Mar 18, 2020 00:59 |
| Version | trunk |
| OS | Windows NT |
| Blocks | llvm/llvm-project#43461 |
| CC | @dstenb,@djtodoro,@JDevlieghere,@walkerkd,@lalozano,@m-gupta,@pogo59,@vedantk |
Extended Description
Found by Manoj Gupta.
https://reviews.llvm.org/D73534#1918890
File:
struct type *a(type *, type *, long, long); enum b {}; static int empty_array(type *, int c) { type *d = a(__null, d, c, c - 1); } long e; b f() { empty_array(0, e); }
Command:
$ clang -cc1 -triple x86_64-linux-gnu -emit-obj -disable-free -mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix -mframe-pointer=all -mconstructor-aliases -munwind-tables -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -O2 -x c++
gives:
clang: /home/edasten/upstream/monorepo/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:630: void addToFwdRegWorklist(FwdRegWorklist&, unsigned int, const llvm::DIExpression*, llvm::ArrayRef
parser at end of file - Code generation
- Running pass 'Function Pass Manager' on module 'combined.c'.
- Running pass 'X86 Assembly Printer' on function '@_ZL11empty_arrayP4typei'
The invalid DIExpression is produced by appending together the following two expressions:
Expr: !DIExpression(DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value) Param.Expr: !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_LLVM_convert, 64, DW_ATE_signed, DW_OP_stack_value)
That results in a DW_OP_stack_value being in the middle of a DIExpression, which is invalid.
The DW_OP_stack_values are added to the expressions due to use of DIExpression::appendExt() which in turn uses appendToStack(). I don't think that the describeLoadedValue() hook should return DIExpressions using DW_OP_stack_value, since that will be used to produce DW_AT_call_values, which are implicitly stack operations.
Thanks, I will re-land the https://reviews.llvm.org/D73534.
This should be fixed in 526c51e.
Great. Thanks!
This should be fixed in 526c51e.
This is currently breaking ToT llvm builds in Chrome OS.
Further reduced reproducer:
extern void callee(long, long); void caller(int c) { callee(c, c - 1); }
The reason for why we're trying to append two convert expressions in the first place is because when trying to describe $eax using:
$eax = LEA64_32r renamable $rdx, 1, $noreg, -1, $noreg
we return ($rdx, DW_OP_constu, 1, DW_OP_minus). I think we want to return the 32-bit sub-register of the source instead.