| Issue |
238754
|
| Summary |
clang++ LTO crash/abort lambda no debug scope
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
zngos
|
Repro on 23.1.5, not on 22.1.8
---m.cppm
```
export module m;
template <class F> [[gnu::noinline]] int call(F f) { return f(); }
export inline int one() { return call([] { return 1; }); }
```
--- use.cpp
```
import m;
extern "C" int _start() { return one(); }
```
```
F="--no-default-config --target=x86_64-unknown-linux-gnu -std=c++20 -g -O2"
clang++ $F --precompile m.cppm -o m.pcm
clang++ $F -S -emit-llvm m.pcm -o m.ll # the scope-less closure type
clang++ $F -flto -c m.pcm -o m.o
clang++ $F -flto -fmodule-file=m=m.pcm -c use.cpp -o use.o
ld.lld m.o use.o -o a.out # links
ld.lld use.o m.o -o a.out # aborts in the verifier
```
```
Compiler: clang version 23.1.5
Linker: LLD 23.1.5 (compatible with GNU linkers)
m.pcm IR, the closure type:
!3 = distinct !DICompositeType(tag: DW_TAG_class_type, file: !4, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: "_ZTSZW1m3onevEUlvE_")
(no scope: the module unit emits it outside one())
use.cpp IR, the closure type:
!23 = !DICompositeType(tag: DW_TAG_class_type, scope: !20, file: !21, line: 3, size: 8, flags: DIFlagFwdDecl, identifier: "_ZTSZW1m3onevEUlvE_")
ld.lld m.o use.o: links
./clangbugrepro/lambda_debug_scope_lto/repro.sh: line 114: 988274 Aborted (core dumped) "$lld" "$tmp/use.o" "$tmp/m.o" -o "$tmp/a.out" 2> "$tmp/err"
ld.lld use.o m.o: aborted
invalid retained nodes, retained node is not local
!28 = distinct !DISubprogram(name: "one", linkageName: "_ZW1m3onev", scope: !6, file: !6, line: 3, type: !23, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !4, keyInstructions: true)
!4 = !{!5}
!5 = distinct !DICompositeType(tag: DW_TAG_class_type, file: !6, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !7, identifier: "_ZTSZW1m3onevEUlvE_")
LLVM ERROR: Broken module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
BUG PRESENT: the LTO link fails the verifier
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs