| Issue |
238154
|
| Summary |
Assertion in ld.lld: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:311: void llvm::Loc::MMI::addFrameIndexExpr(const DIExpression *, int) with LTO
|
| Labels |
lld
|
| Assignees |
|
| Reporter |
gulfemsavrun
|
https://github.com/llvm/llvm-project/pull/197678 caused the following assertion error in `AArch64 Assembly Printer`.
```
FAILED: [code=134] critical-services exe.unstripped/critical-services critical-services.build-id.stamp
ld.lld: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:311: void llvm::Loc::MMI::addFrameIndexExpr(const DIExpression *, int): Assertion `(FrameIndexExprs.size() == 1 || llvm::all_of(FrameIndexExprs, [](const FrameIndexExpr &FIE) { return FIE.Expr && FIE.Expr->isFragment(); })) && "conflicting locations for variable"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: ../../prebuilt/third_party/clang/custom/bin/ld.lld -z max-page-size=4096 -z now -z start-stop-visibility=hidden -z rodynamic -z separate-loadable-segments -z rel --pack-dyn-relocs=relr --sysroot=gen/zircon/public/sysroot -pie --build-id --hash-style=gnu --execute-only --fix-cortex-a53-843419 --eh-frame-hdr -dynamic-linker ld.so.1 -o ./exe.unstripped/critical-services ... -flto ... -gdwarf-5 ...
1. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
2. Running pass 'AArch64 Assembly Printer' on function '@_ZN16storage_watchdog29DumpWedgeDiagnosticsAndRebootENSt3__217basic_string_viewIcNS0_11char_traitsIcEEEEN2zx3jobE'
#0 0x000055ff82dffd38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../prebuilt/third_party/clang/custom/bin/ld.lld+0x9ae0d38)
clang++: error: unable to execute command: Aborted
clang++: error: ld.lld command failed with exit code -2 (use -v to see invocation)
```
Here's a small reproducer:
```
clang++ --target=aarch64-unknown-fuchsia -Os -flto -g -Wl,-O2 -shared -nostdlib -fuse-ld=lld repro.cc
```
```
// repro.cc
void use(void *, long);
void *alloc();
#define R8(x) x, x, x, x, x, x, x, x
extern const long arr[2][64] = {{R8(R8(1))}, {R8(R8(-1))}};
struct Vec {
void *p = nullptr;
long n = 0;
};
void emplace(Vec *v, long trips) {
long s = 0;
for (long iv = 0; iv < trips; ++iv) {
#define ADD(i) + arr[iv][i]
s += 0 ADD(1) ADD(2) ADD(3) ADD(4) ADD(5) ADD(6) ADD(7) ADD(8) ADD(9)
ADD(10) ADD(11) ADD(12) ADD(13) ADD(14) ADD(15) ADD(16) ADD(17)
ADD(18) ADD(19) ADD(20) ADD(21) ADD(22) ADD(23) ADD(24) ADD(25)
ADD(26) ADD(27) ADD(28) ADD(29) ADD(30) ADD(31) ADD(32) ADD(33) ADD(34);
}
v->p = static_cast<char *>(alloc()) + s;
__builtin_assume_separate_storage(v, v->p);
}
void test(bool c1, long *other) {
Vec items;
long *phi;
if (c1) {
phi = &items.n;
emplace(&items, 2);
} else {
use(nullptr, 2);
phi = other;
}
long val = *phi;
*phi = 0;
use(nullptr, val);
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs